diff -uprN -x CVS facebook_status-DRUPAL-6--3/submodules/fbss_rules/fbss_rules.rules.inc facebook_status/submodules/fbss_rules/fbss_rules.rules.inc
--- facebook_status-DRUPAL-6--3/submodules/fbss_rules/fbss_rules.rules.inc	2010-11-30 07:20:44.000000000 +0000
+++ facebook_status/submodules/fbss_rules/fbss_rules.rules.inc	2011-02-01 00:25:38.000000000 +0000
@@ -29,9 +29,9 @@ function fbss_rules_rules_event_info() {
       'label' => t('User saves a status'),
       'module' => 'Facebook-style Statuses',
       'arguments' => array(
-        'owner' => array('type' => 'user', 'label' => t('The user to whose profile the status was posted.')),
-        'poster' => array('type' => 'user', 'label' => t('The user who posted the status.')),
-        'status' => array('type' => 'facebook_status', 'label' => t('The status object.')),
+        'recipient' => array('type' => 'number', 'label' => t('The ID of the object to which the status was posted.')),
+        'sender' => array('type' => 'user', 'label' => t('The user who posted the status.')),
+        'status' => array('type' => 'facebook_status', 'label' => t('The status.')),
       ),
     ),
   );
@@ -52,8 +52,7 @@ function fbss_rules_rules_condition_info
     'facebook_status_can_post' => array(
       'label' => t('User has permission to send a status-message'),
       'arguments' => array(
-        'owner' => array('type' => 'user', 'label' => t('Owner')),
-        'poster' => array('type' => 'user', 'label' => t('Poster')),
+        'sender' => array('type' => 'user', 'label' => t('Sender')),
       ),
       'module' => 'Facebook-style Statuses',
     ),
@@ -78,21 +77,21 @@ function fbss_rules_rules_condition_info
  * Checks if the status was posted to the user's own profile.
  */
 function fbss_rules_is_self($status) {
-  return $status->uid == $status->pid;
+  return $status->sender == $status->recipient;
 }
 
 /**
  * Checks if the current user can edit the status.
  */
 function fbss_rules_rules_condition_can_edit($status) {
-  _facebook_status_can_edit($status);
+  facebook_status_user_access('edit', $status);
 }
 
 /**
  * Checks if the current user can delete the status.
  */
 function fbss_rules_rules_condition_can_delete($status) {
-  _facebook_status_can_edit($status, TRUE);
+  facebook_status_user_access('delete', $status);
 }
 
 /**
@@ -113,7 +112,7 @@ function fbss_rules_rules_action_info() 
       'label' => t('Edit a status'),
       'help' => t('Enter the Status ID of the status to edit and the text you wish to replace the status.'),
       'module' => 'Facebook-style Statuses',
-      'eval input' => array('sid', 'status'),
+      'eval input' => array('sid', 'message'),
     ),
     'fbss_rules_delete_action' => array(
       'label' => t('Delete a status'),
@@ -123,9 +122,9 @@ function fbss_rules_rules_action_info() 
     ),
     'fbss_rules_add_action' => array(
       'label' => t('Add a status'),
-      'help' => t('Enter the status text and the User ID or Username of the user to whose profile the status will be posted.'),
+      'help' => t('Enter the status text and the ID and type of the recipient to which the status will be posted.'),
       'module' => 'Facebook-style Statuses',
-      'eval input' => array('poster', 'uid', 'name', 'status'),
+      'eval input' => array('sender', 'recipient', 'type', 'message'),
     ),
   );
 }
@@ -154,17 +153,17 @@ function fbss_rules_load_action($setting
  * Builds the form for editing a status.
  */
 function fbss_rules_edit_action_form($settings, &$form) {
-  $settings += array('sid' => '', 'status' => '');
+  $settings += array('sid' => '', 'message' => '');
   $form['settings']['sid'] = array(
     '#type' => 'textfield',
     '#title' => t('Status ID'),
     '#default_value' => $settings['sid'],
     '#required' => TRUE,
   );
-  $form['settings']['status'] = array(
+  $form['settings']['message'] = array(
     '#type' => 'textarea',
-    '#title' => t('Status'),
-    '#default_value' => $settings['status'],
+    '#title' => t('Status message'),
+    '#default_value' => $settings['message'],
     '#rows' => 3,
   );
 }
@@ -174,17 +173,17 @@ function fbss_rules_edit_action_form($se
  */
 function fbss_rules_edit_action($settings) {
   $status_old = facebook_status_load($settings['sid']);
-  $account = user_load(array('uid' => $status_old->uid));
-  $new_status = trim($settings['status']);
+  $account = user_load(array('sender' => $status_old->sender));
+  $new_status = trim($settings['message']);
   global $user;
   //If the user clears the status, set the time to zero so the new, blank status will not show up as new in lists.
-  $time = $status_old->status_time;
+  $time = $status_old->created;
   if ($new_status === '') {
     $time = 0;
   }
   //Don't set a new status if the submitted status is exactly the same as the old one.
-  if ($new_status != $status_old->status && $account->uid) {
-    $sql = "UPDATE {facebook_status} SET status = '%s', status_time = %d WHERE sid = %d ORDER BY sid DESC";
+  if ($new_status != $status_old->message && $account->sender) {
+    $sql = "UPDATE {facebook_status} SET message = '%s', created = %d WHERE sid = %d ORDER BY sid DESC";
     db_query($sql, $new_status, $time, $status_old->sid);
     //Invokes hook_facebook_status_save($status_owner_object, &$status, $sid).
     module_invoke_all('facebook_status_save', $account, $new_status, $status_old->sid);
@@ -223,28 +222,28 @@ function fbss_rules_delete_action($setti
  * Builds the form for adding a status.
  */
 function fbss_rules_add_action_form($settings, &$form) {
-  $settings += array('poster' => '', 'uid' => '', 'name' => '', 'status' => '');
-  $form['settings']['poster'] = array(
+  $settings += array('sender' => '', 'recipient' => '', 'type' => '', 'message' => '');
+  $form['settings']['sender'] = array(
     '#type' => 'textfield',
-    '#title' => t('Poster username'),
+    '#title' => t('Sender username'),
     '#autocomplete_path' => 'user/autocomplete',
     '#description' => t('If you leave this blank, the current user will be assumed.'),
-    '#default_value' => $settings['poster'],
+    '#default_value' => $settings['sender'],
   );
-  $form['settings']['uid'] = array(
+  $form['settings']['recipient'] = array(
     '#type' => 'textfield',
-    '#title' => t('Owner user ID'),
-    '#default_value' => $settings['uid'],
+    '#title' => t('Recipient ID'),
+    '#default_value' => $settings['recipient'],
   );
-  $form['settings']['name'] = array(
+  $form['settings']['type'] = array(
     '#type' => 'textfield',
-    '#title' => t('Owner username'),
-    '#default_value' => $settings['name'],
+    '#title' => t('Recipient type'),
+    '#default_value' => $settings['type'],
   );
-  $form['settings']['status'] = array(
+  $form['settings']['message'] = array(
     '#type' => 'textarea',
-    '#title' => t('Status'),
-    '#default_value' => $settings['status'],
+    '#title' => t('Status message'),
+    '#default_value' => $settings['message'],
     '#rows' => 3,
   );
 }
@@ -253,8 +252,8 @@ function fbss_rules_add_action_form($set
  * Validates the form for adding a status.
  */
 function fbss_rules_add_action_validate($form, $form_state) {
-  if (!$form_state['values']['settings']['uid'] && !$form_state['values']['settings']['name']) {
-    form_set_error('settings][uid', t('You must enter either a User ID or Username (or both).'));
+  if (!$form_state['values']['settings']['recipient'] || !$form_state['values']['settings']['type']) {
+    form_set_error('settings][recipient', t('You must enter an object ID and its type.'));
   }
 }
 
@@ -262,24 +261,12 @@ function fbss_rules_add_action_validate(
  * Adds a status.
  */
 function fbss_rules_add_action($settings) {
-  $status = $settings['status'];
-  $from = user_load(array('name' => $settings['poster']));
-  if (!$from->uid) {
-    $from = FALSE;
-  }
-  if ($settings['uid'] && $settings['name']) {
-    $to = user_load(array('uid' => $settings['uid'], 'name' => $settings['name']));
-  }
-  elseif ($settings['uid']) {
-    $to = user_load(array('uid' => $settings['uid']));
-  }
-  elseif ($settings['name']) {
-    $to = user_load(array('name' => $settings['name']));
-  }
-  else {
-    $to = FALSE;
-  }
-  _facebook_status_save_status($to, $from, $status);
+  $type = $settings['type'];
+  $context = facebook_status_determine_context($type);
+  $recipient = $context['handler']->load_recipient($settings['recipient']);
+  $message = $settings['message'];
+  $sender = _facebook_status_user_load($settings['sender']);
+  facebook_status_save_status($recipient, $type, $message, $sender);
 }
 
 /**
@@ -304,7 +291,10 @@ function fbss_rules_rules_data_type_info
 class rules_data_type_facebook_status extends rules_data_type {
   function save() {
     $status = &$this->get();
-    _facebook_status_save_status(user_load(array('uid' => $status->uid)), user_load(array('uid' => $status->pid)), $status->status);
+    $context = facebook_status_determine_context($status->type);
+    $recipient = $context['handler']->load_recipient($status->recipient);
+    $sender = _facebook_status_user_load($status->sender);
+    facebook_status_save_status($recipient, $status->type, $status->message, $sender);
     return TRUE;
   }
   function load($sid) {
@@ -315,3 +305,4 @@ class rules_data_type_facebook_status ex
     return $status->sid;
   }
 }
+
