? fbssc-576278-X.patch
Index: fbssc.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/facebook_status/submodules/fbssc/Attic/fbssc.css,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 fbssc.css
--- fbssc.css	30 Nov 2010 07:20:45 -0000	1.1.2.1
+++ fbssc.css	25 Jan 2011 18:23:35 -0000
@@ -39,7 +39,7 @@
   padding-right: 1em;
 }
 
-.fbssc_time {
+.fbssc_created {
   font-style: italic;
 }
 
@@ -69,11 +69,11 @@
 
 /* The "Show all comments" link. */
 .fbssc_show_comments_link {
-  border-bottom :1px solid #E0E0E0;
+  border-bottom: 1px solid #E0E0E0;
   display: block;
   font-size: 90%;
   padding-bottom: 0.5em;
 }
 
 /* The "Show all comments" link when it expands instead of redirecting. */
-.fbssc_show_comments {}
\ No newline at end of file
+.fbssc_show_comments {}
Index: fbssc.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/facebook_status/submodules/fbssc/Attic/fbssc.install,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 fbssc.install
--- fbssc.install	30 Nov 2010 07:20:45 -0000	1.1.2.1
+++ fbssc.install	25 Jan 2011 18:23:35 -0000
@@ -27,14 +27,14 @@ function fbssc_schema() {
         'default' => 0,
         'description' => 'The Status ID.',
       ),
-      'uid' => array(
+      'sender' => array(
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
         'default' => 0,
         'description' => 'The User ID of the poster of the comment.',
       ),
-      'comment_time' => array(
+      'comment_created' => array(
         'type' => 'int',
         'not null' => TRUE,
         'default' => 0,
@@ -49,8 +49,8 @@ function fbssc_schema() {
     'indexes' => array(
       'cid' => array('cid'),
       'sid' => array('sid'),
-      'uid' => array('uid'),
-      'comment_time' => array('comment_time'),
+      'sender' => array('sender'),
+      'comment_created' => array('comment_created'),
     ),
     'primary key' => array('cid'),
   );
@@ -69,4 +69,4 @@ function fbssc_install() {
  */
 function fbssc_uninstall() {
   drupal_uninstall_schema('fbssc');
-}
\ No newline at end of file
+}
Index: fbssc.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/facebook_status/submodules/fbssc/Attic/fbssc.module,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 fbssc.module
--- fbssc.module	30 Nov 2010 07:20:45 -0000	1.1.2.1
+++ fbssc.module	25 Jan 2011 18:23:35 -0000
@@ -144,12 +144,12 @@ function theme_fbssc_item($comment, $cla
   array_unshift($classes, 'fbssc_comment');
   $classes = implode(' ', $classes);
   $output = '<div class="'. $classes .'">';
-  $output .= '<div class="fbssc_author">'. theme('username', user_load(array('uid' => $comment->uid))) .'</div>';
+  $output .= '<div class="fbssc_author">'. theme('username', _facebook_status_user_load($comment->sender)) .'</div>';
   $comment_text = _facebook_status_run_filter($comment->comment);
   $comment_text = nl2br($comment_text);
   $output .= '<div class="fbssc_text">'. $comment_text .'</div>';
   $output .= '<div class="fbssc_closure">';
-  $output .= '<span class="fbssc_time">'. theme('facebook_status_time', $comment->comment_time) .'</span>';
+  $output .= '<span class="fbssc_created">'. theme('facebook_status_created', $comment->comment_created) .'</span>';
   $q = $_GET['q'];
   if ($destination) {
     $q = $destination;
@@ -296,7 +296,7 @@ function fbssc_load($cid) {
  *   An array of comment objects for the relative thread.
  */
 function fbssc_get_comments($sid) {
-  $result = db_query("SELECT * FROM {fbssc} WHERE sid = %d ORDER BY comment_time ASC, cid ASC", $sid);
+  $result = db_query("SELECT * FROM {fbssc} WHERE sid = %d ORDER BY comment_created ASC, cid ASC", $sid);
   $results = array();
   while ($comment = db_fetch_object($result)) {
     $results[] = $comment;
@@ -312,14 +312,14 @@ function fbssc_get_comments($sid) {
  * @return
  *   The saved status comment object.
  */
-function fbssc_save_comment($sid, $comment, $uid = NULL) {
-  if (!$uid) {
-    $uid = $GLOBALS['user']->uid;
+function fbssc_save_comment($sid, $comment, $sender = NULL) {
+  if (!$sender) {
+    $sender = $GLOBALS['user']->uid;
   }
-  $c = (object) array('sid' => $sid, 'uid' => $uid, 'comment_time' => time(), 'comment' => $comment);
+  $c = (object) array('sid' => $sid, 'sender' => $sender, 'comment_created' => time(), 'comment' => $comment);
   drupal_write_record('fbssc', $c);
   module_invoke_all('fbss_after_save', $c, FALSE);
-  _fbssc_appbar_save($sid, $comment, $uid);
+  _fbssc_appbar_save($sid, $comment, $sender);
   return $c;
 }
 
@@ -356,7 +356,7 @@ function fbssc_has_commented($sid, $uid 
   if (!$uid) {
     $uid = $GLOBALS['user']->uid;
   }
-  $result = db_result(db_query("SELECT COUNT(cid) FROM {fbssc} WHERE sid = %d and UID = %d", $sid, $uid));
+  $result = db_result(db_query("SELECT COUNT(cid) FROM {fbssc} WHERE sid = %d and sender = %d", $sid, $uid));
   return $result > 0;
 }
 
@@ -424,7 +424,7 @@ function fbssc_can_edit($comment, $accou
   //This is in two separate statements (instead of one big return statement)
   //so that the SQL in _fbssc_get_thread_author() does not usually need to be run.
   if ($allow && (user_access('edit all status comments', $account) ||
-    (user_access('edit own status comments', $account) && $account->uid == $comment->uid)
+    (user_access('edit own status comments', $account) && $account->uid == $comment->sender)
   )) {
     return TRUE;
   }
@@ -454,7 +454,7 @@ function fbssc_can_delete($comment, $acc
   //This is in two separate statements (instead of one big return statement)
   //so that the SQL in _fbssc_get_thread_author() does not usually need to be run.
   if ($allow && (user_access('delete all status comments', $account) ||
-    (user_access('delete own status comments', $account) && $account->uid == $comment->uid)
+    (user_access('delete own status comments', $account) && $account->uid == $comment->sender)
   )) {
     return TRUE;
   }
@@ -475,7 +475,7 @@ function fbssc_can_delete($comment, $acc
  *   The User ID of the author of the relevant status.
  */
 function _fbssc_get_thread_author($sid) {
-  return db_result(db_query("SELECT uid FROM {facebook_status} WHERE sid = %d", $sid));
+  return db_result(db_query("SELECT sender FROM {facebook_status} WHERE sid = %d", $sid));
 }
 
 //===============
@@ -610,23 +610,24 @@ function _fbssc_appbar_save($sid, $comme
   if (!module_exists('appbar')) {
     return;
   }
-  $user_link = theme('username', user_load(array('uid' => $uid)));
+  $user_link = theme('username', _facebook_status_user_load($uid));
   $status_link = url('statuses/'. $sid);
   $uids = array();
-  $status = db_fetch_object(db_query("SELECT uid, pid FROM {facebook_status} WHERE sid = %d", $sid));
-  $uids[] = $status->uid;
-  $uids[] = $status->pid;
-  $recipient = theme('username', user_load(array('uid' => $status->uid)));
-  if ($status->uid != $status->pid) {
-    if ($status->uid != $user->uid) {
-      appbar_set_message(t('!user commented on a <a href="!message">message</a> to you.', array('!user' => $user_link, '!message' => $status_link)), 'fbssc-owner', $uids[0]);
+  $status = db_fetch_object(db_query("SELECT sender, recipient, type FROM {facebook_status} WHERE sid = %d", $sid));
+  $context = facebook_status_determine_context($status->type);
+  $recipient = $context['handler']->recipient_link($status->recipient);
+  $uids[] = $status->sender;
+  $uids[] = $status->recipient;
+  if ($status->sender != $status->recipient) {
+    if ($status->sender != $user->uid) {
+      appbar_set_message(t('!user commented on a <a href="!message">message</a> to you.', array('!user' => $user_link, '!message' => $status_link)), 'fbssc-sender', $uids[0]);
     }
-    if ($status->pid != $user->uid) {
-      appbar_set_message(t('!user commented on your <a href="!message">message</a> to !recipient.', array('!user' => $user_link, '!message' => $status_link, '!recipient' => $recipient)), 'fbssc-poster', $uids[1]);
+    if ($status->recipient != $user->uid) {
+      appbar_set_message(t('!user commented on your <a href="!message">message</a> to !recipient.', array('!user' => $user_link, '!message' => $status_link, '!recipient' => $recipient)), 'fbssc-recipient', $uids[1]);
     }
   }
   else {
-    if ($status->uid != $user->uid) {
+    if ($status->sender != $user->uid) {
       appbar_set_message(t('!user commented on your <a href="!message">message</a>.', array('!user' => $user_link, '!message' => $status_link)), 'fbssc-own', $uids[0]);
     }
   }
@@ -639,14 +640,14 @@ function _fbssc_appbar_save($sid, $comme
   array_shift($uids);
   array_shift($uids);
   foreach ($uids as $nuid) {
-    if ($status->uid == $status->pid) {
+    if ($status->sender == $status->recipient) {
       appbar_set_message(t('!user commented on a <a href="!message">status</a> on which you also commented.',
         array('!user' => $user_link, '!message' => $status_link)), 'fbssc-commenter', $nuid);
     }
     else {
       $r = $recipient;
-      if ($status->uid == $nuid) {
-        $r = theme('username', user_load(array('uid' => $nuid)));
+      if ($status->sender == $nuid) {
+        $r = theme('username', _facebook_status_user_load($nuid));
       }
       appbar_set_message(t('!user commented on a <a href="!message">message</a> to !recipient on which you also commented.',
         array('!user' => $user_link, '!message' => $status_link, '!recipient' => $r)), 'fbssc-commenter', $nuid);
@@ -659,9 +660,9 @@ function _fbssc_appbar_save($sid, $comme
  */
 function fbssc_appbar_id() {
   return array(
-    'fbssc-owner' => t('Facebook-style Statuses Comment (to status owner)'),
-    'fbssc-poster' => t('Facebook-style Statuses Comment (to status poster)'),
-    'fbssc-own' => t('Facebook-style Statuses Comment (to status owner on own status)'),
+    'fbssc-recipient' => t('Facebook-style Statuses Comment (to status recipient)'),
+    'fbssc-sender' => t('Facebook-style Statuses Comment (to status sender)'),
+    'fbssc-own' => t('Facebook-style Statuses Comment (to status recipient on own status)'),
     'fbssc-commenter' => t('Facebook-style Statuses Comment (to other commenters)'),
   );
 }
@@ -679,10 +680,10 @@ function fbssc_views_api() {
 function fbssc_views_default_views_alter(&$views) {
   foreach ($views as $view) {
     //We can't use the base_table property because some FBSS views are based on the {users} table.
-    if ($view->tag == 'facebook_status') {
+    if ($view->name == 'facebook_status_stream') {
       //Do some trickery to make sure the comment box comes before the time field so that it's available as a token.
-      $s = $view->display['default']->display_options['fields']['status_time'];
-      unset($view->display['default']->display_options['fields']['status_time']);
+      $s = $view->display['default']->display_options['fields']['nothing'];
+      unset($view->display['default']->display_options['fields']['nothing']);
       //This won't work anywhere fields are overridden in the default views.
       $view->display['default']->display_options['fields']['comment-box'] = array(
         'label' => '',
@@ -716,9 +717,11 @@ function fbssc_views_default_views_alter
           'button' => 'Override',
         ),
       );
-      $view->display['default']->display_options['fields']['status_time'] = $s;
-      $view->display['default']->display_options['fields']['status_time']['alter']['text'] =
-        '[pid_extra] [status] [status_time] [edit] [delete] [respond] [comment-box]';
+      $view->display['default']->display_options['fields']['nothing'] = $s;
+      $view->display['default']->display_options['fields']['nothing']['alter']['text'] = 
+        "<div>[picture] [name] [message]</div>
+
+        <div>[created] [edit] [delete] [respond] [repost] [comment-box]</div>";
     }
   }
-}
\ No newline at end of file
+}
Index: fbssc.views.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/facebook_status/submodules/fbssc/Attic/fbssc.views.inc,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 fbssc.views.inc
--- fbssc.views.inc	30 Nov 2010 07:20:45 -0000	1.1.2.1
+++ fbssc.views.inc	25 Jan 2011 18:23:35 -0000
@@ -15,7 +15,7 @@ function fbssc_views_data() {
   $data['fbssc']['table']['join'] = array(
     'users' => array(
       'left_field' => 'uid',
-      'field' => 'uid',
+      'field' => 'sender',
       'type' => 'INNER',
     ),
     'facebook_status' => array(
@@ -105,8 +105,8 @@ function fbssc_views_data() {
     ),
   );
 
-  //Declares the User ID column.
-  $data['fbssc']['uid'] = array(
+  //Declares the commenter's User ID column.
+  $data['fbssc']['sender'] = array(
     'title' => t('User ID'),
     'help' => t('The User ID of the status comment author.'),
     'field' => array(
@@ -125,7 +125,7 @@ function fbssc_views_data() {
   );
 
   //Declares the status comment timestamp column.
-  $data['fbssc']['comment_time'] = array(
+  $data['fbssc']['comment_created'] = array(
     'title' => t('Created time'),
     'help' => t('The time the status comment was posted.'),
     'field' => array(
@@ -168,7 +168,7 @@ function fbssc_views_data_alter(&$data) 
       'label' => t('Users'),
       'help' => t('Add a relationship to gain access to information related to the users who submitted the relevant status comments.'),
       'relationship table' => 'fbssc',
-      'relationship field' => 'uid',
+      'relationship field' => 'sender',
       'base' => 'users',
       'field' => 'uid',
       'type' => 'INNER',
@@ -211,4 +211,4 @@ function fbssc_views_handlers() {
       ),
     ),
   );
-}
\ No newline at end of file
+}
