add hooks to allow plugins to handle different kinds of activities
This commit is contained in:
parent
4217277d14
commit
8dec16aeeb
|
@ -445,26 +445,31 @@ class Ostatus_profile extends Memcached_DataObject
|
||||||
* @param DOMElement $feed for context
|
* @param DOMElement $feed for context
|
||||||
* @param string $source identifier ("push" or "salmon")
|
* @param string $source identifier ("push" or "salmon")
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function processEntry($entry, $feed, $source)
|
public function processEntry($entry, $feed, $source)
|
||||||
{
|
{
|
||||||
$activity = new Activity($entry, $feed);
|
$activity = new Activity($entry, $feed);
|
||||||
|
|
||||||
// @todo process all activity objects
|
if (Event::handle('StartHandleFeedEntry', array($activity))) {
|
||||||
switch ($activity->objects[0]->type) {
|
|
||||||
case ActivityObject::ARTICLE:
|
|
||||||
case ActivityObject::BLOGENTRY:
|
|
||||||
case ActivityObject::NOTE:
|
|
||||||
case ActivityObject::STATUS:
|
|
||||||
case ActivityObject::COMMENT:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new ClientException("Can't handle that kind of post.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($activity->verb == ActivityVerb::POST) {
|
// @todo process all activity objects
|
||||||
$this->processPost($activity, $source);
|
switch ($activity->objects[0]->type) {
|
||||||
} else {
|
case ActivityObject::ARTICLE:
|
||||||
common_log(LOG_INFO, "Ignoring activity with unrecognized verb $activity->verb");
|
case ActivityObject::BLOGENTRY:
|
||||||
|
case ActivityObject::NOTE:
|
||||||
|
case ActivityObject::STATUS:
|
||||||
|
case ActivityObject::COMMENT:
|
||||||
|
if ($activity->verb == ActivityVerb::POST) {
|
||||||
|
$this->processPost($activity, $source);
|
||||||
|
} else {
|
||||||
|
common_log(LOG_INFO, "Ignoring activity with unrecognized verb $activity->verb");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new ClientException("Can't handle that kind of post.");
|
||||||
|
}
|
||||||
|
|
||||||
|
Event::handle('EndHandleFeedEntry', array($activity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user