]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
if something's a retweet, save it as a repeat in bridge
authorEvan Prodromou <evan@status.net>
Fri, 3 Sep 2010 21:51:28 +0000 (17:51 -0400)
committerEvan Prodromou <evan@status.net>
Tue, 7 Sep 2010 08:00:57 +0000 (04:00 -0400)
plugins/TwitterBridge/daemons/twitterstatusfetcher.php

index cf75e48f68b0a873fa33a90feb5f58ec4d5261ad..848e866697be897f9cfbd006001e798031539f2b 100755 (executable)
@@ -231,14 +231,14 @@ class TwitterStatusFetcher extends ParallelizingDaemon
         $flink->update();
     }
 
-    function saveStatus($status, $flink)
+    function saveStatus($status, $flink=null)
     {
         $profile = $this->ensureProfile($status->user);
 
         if (empty($profile)) {
             common_log(LOG_ERR, $this->name() .
                 ' - Problem saving notice. No associated Profile.');
-            return;
+            return null;
         }
 
         $statusUri = $this->makeStatusURI($status->user->screen_name, $status->id);
@@ -253,7 +253,14 @@ class TwitterStatusFetcher extends ParallelizingDaemon
                 $this->name() .
                 " - Ignoring duplicate import: $statusUri"
             );
-            return;
+            return $dupe;
+        }
+
+        // If it's a retweet, save it as a repeat!
+
+        if (!empty($status->retweeted_status)) {
+            $original = $this->saveStatus($status->retweeted_status);
+            return $original->repeat($profile->id, 'twitter');
         }
 
         $notice = new Notice();
@@ -305,7 +312,9 @@ class TwitterStatusFetcher extends ParallelizingDaemon
             Event::handle('EndNoticeSave', array($notice));
         }
 
-        Inbox::insertNotice($flink->user_id, $notice->id);
+        if (!empty($flink)) {
+            Inbox::insertNotice($flink->user_id, $notice->id);
+        }
         $notice->blowOnInsert();
 
         return $notice;