Merge remote branch 'statusnet/testing' into testing

This commit is contained in:
James Walker 2010-02-22 09:03:42 -05:00
commit 8fe097d7d1
6 changed files with 64 additions and 9 deletions

View File

@ -792,9 +792,11 @@ class Profile extends Memcached_DataObject
* Returns an XML string fragment with profile information as an
* Activity Streams noun object with the given element type.
*
* Assumes that 'activity' namespace has been previously defined.
* Assumes that 'activity', 'georss', and 'poco' namespace has been
* previously defined.
*
* @param string $element one of 'actor', 'subject', 'object', 'target'
*
* @return string
*/
function asActivityNoun($element)
@ -811,9 +813,52 @@ class Profile extends Memcached_DataObject
'id',
null,
$this->getUri()
);
);
// title should contain fullname
$xs->element('title', null, $this->getBestName());
$xs->element('link', array('rel' => 'alternate',
'type' => 'text/html'),
$this->profileurl);
$xs->element('poco:preferredUsername', null, $this->nickname);
// Portable Contacts stuff
if (isset($this->bio)) {
// XXX: Possible to use OpenSocial's aboutMe?
$xs->element('poco:note', null, $this->bio);
}
if (isset($this->homepage)) {
$xs->elementStart('poco:urls');
$xs->element('poco:value', null, $this->homepage);
$xs->element('poco:type', null, 'homepage');
$xs->element('poco:primary', null, 'true');
$xs->elementEnd('poco:urls');
}
if (isset($this->location)) {
$xs->elementStart('poco:address');
$xs->element('poco:formatted', null, $this->location);
$xs->elementEnd('poco:address');
}
if (isset($this->lat) && isset($this->lon)) {
$this->element(
'georss:point',
null,
(float)$this->lat . ' ' . (float)$this->lon
);
}
// XXX: Should we send all avatar sizes we have? I think
// cliqset does -Z
$avatar = $this->getAvatar(AVATAR_PROFILE_SIZE);
$xs->element(
@ -829,6 +874,8 @@ class Profile extends Memcached_DataObject
$xs->elementEnd('activity:' . $element);
// XXX: Add people tags with <poco:tags> plural?
return $xs->getString();
}

View File

@ -109,11 +109,11 @@ class Atom10Feed extends XMLStringer
);
}
if (!is_null($uri)) {
if (isset($uri)) {
$xs->element('uri', null, $uri);
}
if (!is_null(email)) {
if (isset($email)) {
$xs->element('email', null, $email);
}

View File

@ -60,8 +60,7 @@ class AtomUserNoticeFeed extends AtomNoticeFeed
$this->user = $user;
if (!empty($user)) {
$profile = $user->getProfile();
$this->addAuthor($profile->getBestName(),
$user->uri);
$this->addAuthor($profile->nickname, $user->uri);
}
}

View 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

View 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);
}
}

View File

@ -3,7 +3,7 @@
If you already have an account on %%site.name%%, you can [login](%%action.login%%) with your username and password as usual.
To use OpenID in the future, you can [add an OpenID to your account](%%action.openidsettings%%) after you have logged in normally.
There are many [Public OpenID providers](http://wiki.openid.net/Public_OpenID_providers), and you may already have an OpenID-enabled account on another service.
There are many [Public OpenID providers](http://wiki.openid.net/OpenID-Providers), and you may already have an OpenID-enabled account on another service.
* On wikis: If you have an account on an OpenID-enabled wiki, like [Wikitravel](http://wikitravel.org/), [wikiHow](http://www.wikihow.com/), [Vinismo](http://vinismo.com/), [AboutUs](http://aboutus.org/) or [Keiki](http://kei.ki/), you can log in to %%site.name%% by entering the **full URL** of your user page on that other wiki in the box above. For example, *http://kei.ki/en/User:Evan*.
* [Yahoo!](http://openid.yahoo.com/) : If you have an account with Yahoo!, you can log in to this site by entering your Yahoo!-provided OpenID in the box above. Yahoo! OpenID URLs have the form *https://me.yahoo.com/yourusername*.