diff options
author | Brion Vibber <brion@pobox.com> | 2010-12-07 10:50:05 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-12-07 10:50:05 -0800 |
commit | 9df856e667a12cd217576263efbc72fff12692d9 (patch) | |
tree | dc8d588e8b01d1ec788c78d6aec10a9b9d26bec6 /plugins/OStatus/OStatusPlugin.php | |
parent | 01f32e3998b8d031d2a39e2d0506253142b6632e (diff) | |
parent | 4b4b763255ad3b2bff8f18da2bd3927b52a54e55 (diff) |
Merge branch '0.9.x' into merge
Conflicts:
README
actions/hostmeta.php
classes/File_redirection.php
lib/common.php
lib/designsettings.php
lib/router.php
lib/util.php
lib/xmppmanager.php
plugins/OStatus/OStatusPlugin.php
Diffstat (limited to 'plugins/OStatus/OStatusPlugin.php')
-rw-r--r-- | plugins/OStatus/OStatusPlugin.php | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index e38d52d3d..f846a2fc8 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -52,8 +52,6 @@ class OStatusPlugin extends Plugin function onRouterInitialized($m) { // Discovery actions - $m->connect('main/xrd', - array('action' => 'userxrd')); $m->connect('main/ownerxrd', array('action' => 'ownerxrd')); $m->connect('main/ostatus', @@ -1010,11 +1008,43 @@ class OStatusPlugin extends Plugin return true; } - function onStartHostMetaLinks(&$links) { - $url = common_local_url('userxrd'); - $url.= '?uri={uri}'; - $links[] = array('rel' => Discovery::LRDD_REL, - 'template' => $url, - 'title' => array('Resource Descriptor')); + function onEndXrdActionLinks(&$xrd, $user) + { + $xrd->links[] = array('rel' => Discovery::UPDATESFROM, + 'href' => common_local_url('ApiTimelineUser', + array('id' => $user->id, + 'format' => 'atom')), + 'type' => 'application/atom+xml'); + + // Salmon + $salmon_url = common_local_url('usersalmon', + array('id' => $user->id)); + + $xrd->links[] = array('rel' => Salmon::REL_SALMON, + 'href' => $salmon_url); + // XXX : Deprecated - to be removed. + $xrd->links[] = array('rel' => Salmon::NS_REPLIES, + 'href' => $salmon_url); + + $xrd->links[] = array('rel' => Salmon::NS_MENTIONS, + 'href' => $salmon_url); + + // Get this user's keypair + $magickey = Magicsig::staticGet('user_id', $user->id); + if (!$magickey) { + // No keypair yet, let's generate one. + $magickey = new Magicsig(); + $magickey->generate($user->id); + } + + $xrd->links[] = array('rel' => Magicsig::PUBLICKEYREL, + 'href' => 'data:application/magic-public-key,'. $magickey->toString(false)); + + // TODO - finalize where the redirect should go on the publisher + $url = common_local_url('ostatussub') . '?profile={uri}'; + $xrd->links[] = array('rel' => 'http://ostatus.org/schema/1.0/subscribe', + 'template' => $url ); + + return true; } } |