Queue notices for rssCloud
This commit is contained in:
parent
46ac99cf4d
commit
aa9f81193e
|
@ -130,20 +130,51 @@ class RSSCloudPlugin extends Plugin
|
|||
}
|
||||
}
|
||||
|
||||
function onEndNoticeSave($notice){
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
common_debug("RSSCloudPlugin oneEndNoticeSave()");
|
||||
/**
|
||||
* 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))) {
|
||||
|
||||
$user = User::staticGet('id', $notice->profile_id);
|
||||
$feed = common_local_url('api', array('apiaction' => 'statuses',
|
||||
'method' => 'user_timeline',
|
||||
'argument' => $user->nickname . '.rss'));
|
||||
// broadcast the notice here
|
||||
common_debug('broadcasting rssCloud bound notice ' . $notice->id);
|
||||
|
||||
// XXX: Dave's hub for testing
|
||||
// $endpoint = 'http://rpc.rsscloud.org:5337/rsscloud/ping';
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// $notifier = new RSSCloudNotifier();
|
||||
// $notifier->postUpdate($endpoint, $feed);
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user