]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
handle poco nicknames in Ostatus_profile
authorEvan Prodromou <evan@status.net>
Mon, 22 Feb 2010 12:57:44 +0000 (07:57 -0500)
committerEvan Prodromou <evan@status.net>
Mon, 22 Feb 2010 12:57:44 +0000 (07:57 -0500)
plugins/OStatus/classes/Ostatus_profile.php
plugins/OStatus/lib/activity.php

index 71885bcdce9618fc012b001e8efea7730950cfb7..0e12f8fc6e14005b50648b22311c832f320e91f6 100644 (file)
@@ -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
 
index af83f8bc666a6c03cb5694ece6c6f91e9fa42f91..a26248f199c1a01e552c3d03f227b0d1bd065d3c 100644 (file)
@@ -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);
         }
     }