summaryrefslogtreecommitdiff
path: root/plugins/TwitterBridge/daemons
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2009-12-04 20:17:42 +0000
committerZach Copley <zach@status.net>2009-12-04 20:17:42 +0000
commitcff12603cf13ddde59f82597cdf896bf0deaf596 (patch)
tree27a70ad88f396595867e3b6ead32ad5d6147fd5d /plugins/TwitterBridge/daemons
parent2c07d4a530e2e8ea6a48f08806f5026df1132152 (diff)
Make imported Twitter notices show up via real time plugins.
Diffstat (limited to 'plugins/TwitterBridge/daemons')
-rwxr-xr-xplugins/TwitterBridge/daemons/twitterstatusfetcher.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php
index eba1d563b..d8901f47b 100755
--- a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php
+++ b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php
@@ -209,7 +209,11 @@ class TwitterStatusFetcher extends ParallelizingDaemon
continue;
}
- $this->saveStatus($status, $flink);
+ $notice = null;
+
+ $notice = $this->saveStatus($status, $flink);
+
+ common_broadcast_notice($notice);
}
// Okay, record the time we synced with Twitter for posterity
@@ -235,12 +239,14 @@ class TwitterStatusFetcher extends ParallelizingDaemon
$uri = 'http://twitter.com/' . $status->user->screen_name .
'/status/' . $status->id;
- $notice = Notice::staticGet('uri', $uri);
-
// check to see if we've already imported the status
+ $notice = Notice::staticGet('uri', $uri);
+
if (empty($notice)) {
+ // XXX: transaction here?
+
$notice = new Notice();
$notice->profile_id = $id;
@@ -257,6 +263,7 @@ class TwitterStatusFetcher extends ParallelizingDaemon
$id = $notice->insert();
Event::handle('EndNoticeSave', array($notice));
}
+
}
if (!Notice_inbox::pkeyGet(array('notice_id' => $notice->id,
@@ -270,7 +277,12 @@ class TwitterStatusFetcher extends ParallelizingDaemon
$inbox->source = NOTICE_INBOX_SOURCE_GATEWAY; // From a private source
$inbox->insert();
+
}
+
+ $notice->blowCaches();
+
+ return $notice;
}
function ensureProfile($user)