We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit db9e57f7 authored by Evan Prodromou's avatar Evan Prodromou

ensure from an RSS channel

parent 022c1341
...@@ -788,9 +788,20 @@ class Ostatus_profile extends Memcached_DataObject ...@@ -788,9 +788,20 @@ class Ostatus_profile extends Memcached_DataObject
throw new FeedSubNoHubException(); 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); $subject = ActivityUtils::child($feedEl, Activity::SUBJECT, Activity::SPEC);
...@@ -838,6 +849,17 @@ class Ostatus_profile extends Memcached_DataObject ...@@ -838,6 +849,17 @@ class Ostatus_profile extends Memcached_DataObject
throw new FeedSubException("Can't find enough profile information to make a feed."); 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 * Download and update given avatar image
* *
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment