]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
add hooks to allow plugins to handle different kinds of activities
authorEvan Prodromou <evan@status.net>
Fri, 13 Aug 2010 20:14:47 +0000 (13:14 -0700)
committerEvan Prodromou <evan@status.net>
Fri, 13 Aug 2010 20:14:47 +0000 (13:14 -0700)
plugins/OStatus/classes/Ostatus_profile.php

index 8f8eb773f87dfeec0701990db5a6dfd6c5f1fddd..1fae468f66b10b66c144b97b3cc102bc17f800aa 100644 (file)
@@ -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));
         }
     }