summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/OStatus/classes/Ostatus_profile.php40
1 files changed, 36 insertions, 4 deletions
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php
index bff6ff209..4f449a44d 100644
--- a/plugins/OStatus/classes/Ostatus_profile.php
+++ b/plugins/OStatus/classes/Ostatus_profile.php
@@ -787,9 +787,20 @@ class Ostatus_profile extends Memcached_DataObject
throw new FeedSubNoHubException();
}
- // Try to get a profile from the feed activity:subject
+ $feedEl = $discover->root;
- $feedEl = $discover->feed->documentElement;
+ if ($feedEl->tagName == 'feed') {
+ return self::ensureAtomFeed($feedEl, $hints);
+ } else if ($feedEl->tagName == 'channel') {
+ return self::ensureRssChannel($feedEl, $hints);
+ } else {
+ throw new FeedSubBadXmlException($feeduri);
+ }
+ }
+
+ public static function ensureAtomFeed($feedEl, $hints)
+ {
+ // Try to get a profile from the feed activity:subject
$subject = ActivityUtils::child($feedEl, Activity::SUBJECT, Activity::SPEC);
@@ -837,6 +848,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
*
@@ -1299,9 +1321,19 @@ class Ostatus_profile extends Memcached_DataObject
return $hints['nickname'];
}
- // Try the definitive ID
+ // Try the profile url (like foo.example.com or example.com/user/foo)
- $nickname = self::nicknameFromURI($object->id);
+ $profileUrl = ($object->link) ? $object->link : $hints['profileurl'];
+
+ if (!empty($profileUrl)) {
+ $nickname = self::nicknameFromURI($profileUrl);
+ }
+
+ // Try the URI (may be a tag:, http:, acct:, ...
+
+ if (empty($nickname)) {
+ $nickname = self::nicknameFromURI($object->id);
+ }
// Try a Webfinger if one was passed (way) down