summaryrefslogtreecommitdiff
path: root/plugins/OStatus/actions
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/OStatus/actions')
-rw-r--r--plugins/OStatus/actions/hostmeta.php16
-rw-r--r--plugins/OStatus/actions/ostatusinit.php6
-rw-r--r--plugins/OStatus/actions/xrd.php (renamed from plugins/OStatus/actions/webfinger.php)14
3 files changed, 21 insertions, 15 deletions
diff --git a/plugins/OStatus/actions/hostmeta.php b/plugins/OStatus/actions/hostmeta.php
index 850b8a0fe..3d00b98ae 100644
--- a/plugins/OStatus/actions/hostmeta.php
+++ b/plugins/OStatus/actions/hostmeta.php
@@ -31,12 +31,18 @@ class HostMetaAction extends Action
{
parent::handle();
- $w = new Webfinger();
-
-
$domain = common_config('site', 'server');
- $url = common_local_url('webfinger');
+ $url = common_local_url('xrd');
$url.= '?uri={uri}';
- print $w->getHostMeta($domain, $url);
+
+ $xrd = new XRD();
+
+ $xrd = new XRD();
+ $xrd->host = $domain;
+ $xrd->links[] = array('rel' => Discovery::LRDD_REL,
+ 'template' => $url,
+ 'title' => array('Resource Descriptor'));
+
+ print $xrd->toXML();
}
}
diff --git a/plugins/OStatus/actions/ostatusinit.php b/plugins/OStatus/actions/ostatusinit.php
index 3f2f6368f..8ba8dcdcc 100644
--- a/plugins/OStatus/actions/ostatusinit.php
+++ b/plugins/OStatus/actions/ostatusinit.php
@@ -131,9 +131,9 @@ class OStatusInitAction extends Action
function connectWebfinger($acct)
{
- $w = new Webfinger;
+ $disco = new Discovery;
- $result = $w->lookup($acct);
+ $result = $disco->lookup($acct);
if (!$result) {
$this->clientError(_m("Couldn't look up OStatus account profile."));
}
@@ -144,7 +144,7 @@ class OStatusInitAction extends Action
$user = User::staticGet('nickname', $this->nickname);
$target_profile = common_local_url('userbyid', array('id' => $user->id));
- $url = $w->applyTemplate($link['template'], $target_profile);
+ $url = Discovery::applyTemplate($link['template'], $target_profile);
common_log(LOG_INFO, "Sending remote subscriber $acct to $url");
common_redirect($url, 303);
}
diff --git a/plugins/OStatus/actions/webfinger.php b/plugins/OStatus/actions/xrd.php
index e292ccec9..e6b694d61 100644
--- a/plugins/OStatus/actions/webfinger.php
+++ b/plugins/OStatus/actions/xrd.php
@@ -24,7 +24,7 @@
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
-class WebfingerAction extends Action
+class XrdAction extends Action
{
public $uri;
@@ -40,11 +40,11 @@ class WebfingerAction extends Action
function handle()
{
- $acct = Webfinger::normalize($this->uri);
+ $acct = Discovery::normalize($this->uri);
$xrd = new XRD();
- list($nick, $domain) = explode('@', urldecode($acct));
+ list($nick, $domain) = explode('@', substr(urldecode($acct), 5));
$nick = common_canonical_nickname($nick);
$this->user = User::staticGet('nickname', $nick);
@@ -55,18 +55,18 @@ class WebfingerAction extends Action
$xrd->subject = $this->uri;
$xrd->alias[] = common_profile_url($nick);
- $xrd->links[] = array('rel' => Webfinger::PROFILEPAGE,
+ $xrd->links[] = array('rel' => Discovery::PROFILEPAGE,
'type' => 'text/html',
'href' => common_profile_url($nick));
- $xrd->links[] = array('rel' => Webfinger::UPDATESFROM,
+ $xrd->links[] = array('rel' => Discovery::UPDATESFROM,
'href' => common_local_url('ApiTimelineUser',
array('id' => $this->user->id,
'format' => 'atom')),
'type' => 'application/atom+xml');
// hCard
- $xrd->links[] = array('rel' => Webfinger::HCARD,
+ $xrd->links[] = array('rel' => Discovery::HCARD,
'type' => 'text/html',
'href' => common_local_url('hcard', array('nickname' => $nick)));
@@ -91,7 +91,7 @@ class WebfingerAction extends Action
if (!$magickey) {
// No keypair yet, let's generate one.
$magickey = new Magicsig();
- $magickey->generate();
+ $magickey->generate($this->user->id);
}
$xrd->links[] = array('rel' => Magicsig::PUBLICKEYREL,