summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2009-11-03 17:53:17 -0800
committerZach Copley <zach@status.net>2010-01-05 22:59:42 -0800
commitaa9f81193e9f623dec136c6c5b7ddd6ebb948ab0 (patch)
tree47d739f8a1fd81bacf670ce24649b72c2208d79a /plugins
parent46ac99cf4dc58b4e92a9b2397658ad8a093ee02f (diff)
Queue notices for rssCloud
Diffstat (limited to 'plugins')
-rw-r--r--plugins/RSSCloud/RSSCloudPlugin.php57
1 files changed, 44 insertions, 13 deletions
diff --git a/plugins/RSSCloud/RSSCloudPlugin.php b/plugins/RSSCloud/RSSCloudPlugin.php
index a86c153f1..816739889 100644
--- a/plugins/RSSCloud/RSSCloudPlugin.php
+++ b/plugins/RSSCloud/RSSCloudPlugin.php
@@ -130,21 +130,52 @@ class RSSCloudPlugin extends Plugin
}
}
- function onEndNoticeSave($notice){
-
- common_debug("RSSCloudPlugin oneEndNoticeSave()");
-
- $user = User::staticGet('id', $notice->profile_id);
- $feed = common_local_url('api', array('apiaction' => 'statuses',
- 'method' => 'user_timeline',
- 'argument' => $user->nickname . '.rss'));
-
- // XXX: Dave's hub for testing
- // $endpoint = 'http://rpc.rsscloud.org:5337/rsscloud/ping';
+ /**
+ * Add an RSSCloud queue item for each notice
+ *
+ * @param Notice $notice the notice
+ * @param array &$transports the list of transports (queues)
+ *
+ * @return boolean hook return
+ */
+ function onStartEnqueueNotice($notice, &$transports)
+ {
+ array_push($transports, 'rsscloud');
+ return true;
+ }
- // $notifier = new RSSCloudNotifier();
- // $notifier->postUpdate($endpoint, $feed);
+ /**
+ * broadcast the message when not using queuehandler
+ *
+ * @param Notice &$notice the notice
+ * @param array $queue destination queue
+ *
+ * @return boolean hook return
+ */
+ function onUnqueueHandleNotice(&$notice, $queue)
+ {
+ if (($queue == 'rsscloud') && ($this->_isLocal($notice))) {
+
+ // broadcast the notice here
+ common_debug('broadcasting rssCloud bound notice ' . $notice->id);
+
+ return false;
+ }
+ return true;
}
+ /**
+ * Determine whether the notice was locally created
+ *
+ * @param Notice $notice
+ *
+ * @return boolean locality
+ */
+ function _isLocal($notice)
+ {
+ return ($notice->is_local == Notice::LOCAL_PUBLIC ||
+ $notice->is_local == Notice::LOCAL_NONPUBLIC);
+ }
+
}