]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
use Posterous element if available for RssChannel discovery
authorEvan Prodromou <evan@status.net>
Sat, 20 Mar 2010 22:18:55 +0000 (17:18 -0500)
committerEvan Prodromou <evan@status.net>
Sat, 20 Mar 2010 22:18:55 +0000 (17:18 -0500)
plugins/OStatus/classes/Ostatus_profile.php

index efb12a2dd34fd554e8e5520c867c0a663bcee949..1c110ab2472dc7995768d62de3f44b792ab17e90 100644 (file)
@@ -893,6 +893,20 @@ class Ostatus_profile extends Memcached_DataObject
 
     public static function ensureRssChannel($feedEl, $hints)
     {
+        // Special-case for Posterous. They have some nice metadata in their
+        // posterous:author elements. We should use them instead of the channel.
+
+        $items = $feedEl->getElementsByTagName('item');
+
+        if ($items->length > 0) {
+            $item = $items->item(0);
+            $authorEl = ActivityUtils::child($item, ActivityObject::AUTHOR, ActivityObject::POSTEROUS);
+            if (!empty($authorEl)) {
+                $obj = ActivityObject::fromPosterousAuthor($authorEl);
+                return self::ensureActivityObjectProfile($obj, $hints);
+            }
+        }
+
         // @fixme we should check whether this feed has elements
         // with different <author> or <dc:creator> elements, and... I dunno.
         // Do something about that.