diff options
author | Brion Vibber <brion@pobox.com> | 2010-10-18 15:21:02 -0700 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-10-18 15:21:02 -0700 |
commit | 53d45d7ffbe6bcdf336a0e666942557c11cf909b (patch) | |
tree | 7c26b636624162fd1036529ecc08ae63caef59f6 /plugins/OStatus/lib/xrdaction.php | |
parent | 9a35e48ee2a15ded31dd1dba8e0af9071e8a28ac (diff) | |
parent | 39cfdf0d8b333fec0c35e02d3ce9abb4f4338bf5 (diff) |
Merge branch '0.9.x'
Diffstat (limited to 'plugins/OStatus/lib/xrdaction.php')
-rw-r--r-- | plugins/OStatus/lib/xrdaction.php | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/plugins/OStatus/lib/xrdaction.php b/plugins/OStatus/lib/xrdaction.php index c8b5beff3..371c11080 100644 --- a/plugins/OStatus/lib/xrdaction.php +++ b/plugins/OStatus/lib/xrdaction.php @@ -22,7 +22,9 @@ * @maintainer James Walker <james@status.net> */ -if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET')) { + exit(1); +} class XrdAction extends Action { @@ -34,7 +36,8 @@ class XrdAction extends Action function handle() { - $nick = $this->user->nickname; + $nick = $this->user->nickname; + $profile = $this->user->getProfile(); if (empty($this->xrd)) { $xrd = new XRD(); @@ -45,10 +48,28 @@ class XrdAction extends Action if (empty($xrd->subject)) { $xrd->subject = Discovery::normalize($this->uri); } - $xrd->alias[] = $this->user->uri; + + // Possible aliases for the user + + $uris = array($this->user->uri, $profile->profileurl); + + // FIXME: Webfinger generation code should live somewhere on its own + + $path = common_config('site', 'path'); + + if (empty($path)) { + $uris[] = sprintf('acct:%s@%s', $nick, common_config('site', 'server')); + } + + foreach ($uris as $uri) { + if ($uri != $xrd->subject) { + $xrd->alias[] = $uri; + } + } + $xrd->links[] = array('rel' => Discovery::PROFILEPAGE, 'type' => 'text/html', - 'href' => $this->user->uri); + 'href' => $profile->profileurl); $xrd->links[] = array('rel' => Discovery::UPDATESFROM, 'href' => common_local_url('ApiTimelineUser', @@ -64,7 +85,7 @@ class XrdAction extends Action // XFN $xrd->links[] = array('rel' => 'http://gmpg.org/xfn/11', 'type' => 'text/html', - 'href' => $this->user->uri); + 'href' => $profile->profileurl); // FOAF $xrd->links[] = array('rel' => 'describedby', 'type' => 'application/rdf+xml', |