diff options
author | Evan Prodromou <evan@status.net> | 2010-08-13 13:14:47 -0700 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-08-13 13:14:47 -0700 |
commit | 8dec16aeebc723d36e31f4a3fa5e695bdf92647b (patch) | |
tree | 4ea2af4f0cc2fe2f9989af1fd41b37ea23d83a4f /plugins/OStatus/classes | |
parent | 4217277d14ef1b244a15a8c2fe5dd41e7be6ed1e (diff) |
add hooks to allow plugins to handle different kinds of activities
Diffstat (limited to 'plugins/OStatus/classes')
-rw-r--r-- | plugins/OStatus/classes/Ostatus_profile.php | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index 8f8eb773f..1fae468f6 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -445,26 +445,31 @@ class Ostatus_profile extends Memcached_DataObject * @param DOMElement $feed for context * @param string $source identifier ("push" or "salmon") */ + public function processEntry($entry, $feed, $source) { $activity = new Activity($entry, $feed); - // @todo process all activity objects - 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 (Event::handle('StartHandleFeedEntry', array($activity))) { + + // @todo process all activity objects + switch ($activity->objects[0]->type) { + case ActivityObject::ARTICLE: + 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."); + } - if ($activity->verb == ActivityVerb::POST) { - $this->processPost($activity, $source); - } else { - common_log(LOG_INFO, "Ignoring activity with unrecognized verb $activity->verb"); + Event::handle('EndHandleFeedEntry', array($activity)); } } |