diff options
author | Evan Prodromou <evan@status.net> | 2010-02-22 07:57:44 -0500 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-02-22 07:57:44 -0500 |
commit | 75fdef209245bf9424d4b995a42e4dfd980469d2 (patch) | |
tree | 47196e16ac4bfe824b3d9ff9875d9c189b0161b3 /plugins | |
parent | b79d4ed6a1e61c600fdd382f3bdfde62aaa15b3d (diff) |
handle poco nicknames in Ostatus_profile
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/OStatus/classes/Ostatus_profile.php | 4 | ||||
-rw-r--r-- | plugins/OStatus/lib/activity.php | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index 71885bcdc..0e12f8fc6 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -832,7 +832,9 @@ class Ostatus_profile extends Memcached_DataObject protected static function getActivityObjectNickname($object, $hints=array()) { - // XXX: check whatever PoCo calls a nickname first + if (!empty($object->nickname)) { + return common_nicknamize($object->nickname); + } // Try the definitive ID diff --git a/plugins/OStatus/lib/activity.php b/plugins/OStatus/lib/activity.php index af83f8bc6..a26248f19 100644 --- a/plugins/OStatus/lib/activity.php +++ b/plugins/OStatus/lib/activity.php @@ -31,6 +31,12 @@ if (!defined('STATUSNET')) { exit(1); } +class PoCo +{ + const NS = 'http://portablecontacts.net/spec/1.0'; + const USERNAME = 'preferredUsername'; +} + /** * Utilities for turning DOMish things into Activityish things * @@ -319,7 +325,8 @@ class ActivityObject $this->displayName = $this->title; // @fixme we may have multiple avatars with different resolutions specified - $this->avatar = ActivityUtils::getLink($element, 'avatar'); + $this->avatar = ActivityUtils::getLink($element, 'avatar'); + $this->nickname = ActivityUtils::childContent($element, PoCo::USERNAME, PoCo::NS); } } |