summaryrefslogtreecommitdiff
path: root/plugins/OStatus/classes
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-03-19 15:50:06 -0500
committerEvan Prodromou <evan@status.net>2010-03-19 15:50:06 -0500
commitdb9e57f761b6414e974163e7224d7f04ece291d7 (patch)
tree6d11caea07169f9abff6aff7a0593027e927e4bc /plugins/OStatus/classes
parent022c13418dd268ee1955614d06c264c16bf779cb (diff)
ensure from an RSS channel
Diffstat (limited to 'plugins/OStatus/classes')
-rw-r--r--plugins/OStatus/classes/Ostatus_profile.php26
1 files changed, 24 insertions, 2 deletions
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php
index e0e0223b8..80b980aba 100644
--- a/plugins/OStatus/classes/Ostatus_profile.php
+++ b/plugins/OStatus/classes/Ostatus_profile.php
@@ -788,9 +788,20 @@ class Ostatus_profile extends Memcached_DataObject
throw new FeedSubNoHubException();
}
- // Try to get a profile from the feed activity:subject
+ $feedEl = $discover->root;
+
+ if ($feedEl->tagName == 'feed') {
+ return self::ensureAtomFeed($feedEl, $hints);
+ } else if ($feedEl->tagName == 'channel') {
+ return self::ensureRssChannel($feedEl, $hints);
+ } else {
+ throw new FeedSubBadXmlException($feeduri);
+ }
+ }
- $feedEl = $discover->feed->documentElement;
+ public static function ensureAtomFeed($feedEl, $hints)
+ {
+ // Try to get a profile from the feed activity:subject
$subject = ActivityUtils::child($feedEl, Activity::SUBJECT, Activity::SPEC);
@@ -838,6 +849,17 @@ class Ostatus_profile extends Memcached_DataObject
throw new FeedSubException("Can't find enough profile information to make a feed.");
}
+ public static function ensureRssChannel($feedEl, $hints)
+ {
+ // @fixme we should check whether this feed has elements
+ // with different <author> or <dc:creator> elements, and... I dunno.
+ // Do something about that.
+
+ $obj = ActivityObject::fromRssChannel($feedEl);
+
+ return self::ensureActivityObjectProfile($obj, $hints);
+ }
+
/**
* Download and update given avatar image
*