]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
special case for parsing embedded activities in SHARE verb
authorEvan Prodromou <evan@status.net>
Tue, 19 Jul 2011 20:02:28 +0000 (16:02 -0400)
committerEvan Prodromou <evan@status.net>
Tue, 19 Jul 2011 20:02:28 +0000 (16:02 -0400)
lib/activity.php

index 2b5bfd9822db5b2a2a6566084bae543481fd895e..f5590047d46733f84278978d13cbc3e0586c0c99 100644 (file)
@@ -135,6 +135,9 @@ class Activity
         } else if ($entry->namespaceURI == Activity::RSS &&
                    $entry->localName == 'item') {
             $this->_fromRssItem($entry, $feed);
+        } else if ($entry->namespaceURI == Activity::SPEC &&
+                   $entry->localName == 'object') {
+            $this->_fromAtomEntry($entry, $feed);
         } else {
             // Low level exception. No need for i18n.
             throw new Exception("Unknown DOM element: {$entry->namespaceURI} {$entry->localName}");
@@ -173,9 +176,16 @@ class Activity
         if ($objectEls->length > 0) {
             for ($i = 0; $i < $objectEls->length; $i++) {
                 $objectEl = $objectEls->item($i);
-                $this->objects[] = new ActivityObject($objectEl);
+                // Special case for embedded activities
+                $objectType = ActivityUtils::childContent($objectEl, self::OBJECTTYPE, self::SPEC);
+                if (!empty($objectType) && $objectType == ActivityObject::ACTIVITY) {
+                    $this->objects[] = new Activity($objectEl);
+                } else {
+                    $this->objects[] = new ActivityObject($objectEl);
+                }
             }
         } else {
+            // XXX: really?
             $this->objects[] = new ActivityObject($entry);
         }