diff options
author | Evan Prodromou <evan@status.net> | 2010-10-14 11:06:57 -0400 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-10-14 11:06:57 -0400 |
commit | 23ac9616245f8dfb11e2184f739059d22838010c (patch) | |
tree | f5c314dc812b5f69d11bc9708bc6f659283172b0 /plugins | |
parent | 97a7fb246c8de9a2cf1bfc38ca275a13e9c40f58 (diff) |
Show Webfinger, URI and profile page as subject and aliases
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/OStatus/lib/xrdaction.php | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/plugins/OStatus/lib/xrdaction.php b/plugins/OStatus/lib/xrdaction.php index d1488dbde..371c11080 100644 --- a/plugins/OStatus/lib/xrdaction.php +++ b/plugins/OStatus/lib/xrdaction.php @@ -36,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(); @@ -47,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', @@ -66,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', |