--- activitystream.module.old	2008-09-07 20:53:22.000000000 +0200
+++ activitystream.module	2009-04-09 17:32:39.000000000 +0200
@@ -65,10 +65,31 @@ function activitystream_menu() {
     'access arguments' => array('access content'),
     'type' => MENU_CALLBACK,
   );
+  $items['user-stream'] = array(
+    'title' => 'User Activity Stream',
+    'page callback' => '_activitystream_user_redirect',
+    'access arguments' => array('use activitystream'),
+  );
   return $items;
 }
 
 /**
+ * Implementation of hook_perm().
+ */
+function activitystream_perm() {
+  return array('edit own stream items', 'edit any stream item', 'delete own stream items', 'delete any stream item', 'use activitystream');
+}
+
+/**
+ * simple redirect function to redirect user to their activitystream set up page
+ */
+function _activitystream_user_redirect(){
+  global $user;
+  drupal_goto("user/{$user->uid}/edit/activitystream");
+  exit;
+}
+
+/**
  * Implementation of hook_node_info().
  */
 function activitystream_node_info() {
@@ -84,6 +105,28 @@ function activitystream_node_info() {
 }
 
 /**
+ * Implementation of hook_access().
+ *
+ * Define four different access controls. "edit/delete own content" and 
+ * "edit/delete any content"
+ */
+function activitystream_access($op, $node, $account) {
+  if ($op == 'update') {
+    if (user_access('edit own stream items', $account) && ($account->uid == $node->uid)) {
+      return TRUE;
+    }
+    return user_access('edit any stream item', $account);
+  }
+
+  if ($op == 'delete') {
+    if (user_access('delete own stream items', $account) && ($account->uid == $node->uid)) {
+      return TRUE;
+    }
+    return user_access('delete any stream item', $account);
+  }
+}
+
+/**
  * Implementation of hook_nodeapi(). 
  * When a node is deleted, also delete the associated record in the stream table.
  */
@@ -563,7 +606,7 @@ function activitystream_views_default_vi
 function activitystream_block($op = 'list', $delta = 0) {
   if ($op == 'list') {
     $blocks[0]['info'] = variable_get('activitystream_title', 'Activity Stream');
-    
+    $blocks[1]['info'] = t('User\'s activity stream');
     return $blocks;
   }
   else if ($op == 'view') {
@@ -574,6 +617,14 @@ function activitystream_block($op = 'lis
         $block['subject'] = t($title);
         $block['content'] = block_activitystream_content(0);
         break;
+
+      case 1:
+        // basic validation
+        $arg = arg();
+        if (count($arg) == 2 && $arg[0] == 'user' && is_numeric($arg[1]) && ($user = activitystream_user_load($arg[1]))) {
+          $block['subject'] = t('My activity');
+          $block['content'] = block_activitystream_content(1, $user);
+        }
       
     }
     return $block;
@@ -589,5 +640,9 @@ function block_activitystream_content($w
     case 0:
       $items = _activitystream_get_activity();
       return theme('activitystream', $items);
+    case 1:
+      $args = func_get_args();
+      $items = _activitystream_get_activity($args[1]);
+      return theme('activitystream', $items);
   }
 }
