summaryrefslogtreecommitdiff
path: root/plugins/OStatus/OStatusPlugin.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-02-26 09:35:28 -0800
committerBrion Vibber <brion@pobox.com>2010-02-26 09:35:28 -0800
commit8dfc8f1635940b096e7f4025e3aef0ca4f909eb2 (patch)
tree9fce4aa765d56496031698f219da2f0f82b33e80 /plugins/OStatus/OStatusPlugin.php
parent8914b69d5055c1bc7d0604ee338ffdaf6b0a8606 (diff)
parentb331e971b055386a126aaec27d661f26ba3b813c (diff)
Merge branch 'testing' into 0.9.x
Diffstat (limited to 'plugins/OStatus/OStatusPlugin.php')
-rw-r--r--plugins/OStatus/OStatusPlugin.php34
1 files changed, 29 insertions, 5 deletions
diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php
index e7ffd6cc2..543944454 100644
--- a/plugins/OStatus/OStatusPlugin.php
+++ b/plugins/OStatus/OStatusPlugin.php
@@ -43,8 +43,8 @@ class OStatusPlugin extends Plugin
// Discovery actions
$m->connect('.well-known/host-meta',
array('action' => 'hostmeta'));
- $m->connect('main/webfinger',
- array('action' => 'webfinger'));
+ $m->connect('main/xrd',
+ array('action' => 'xrd'));
$m->connect('main/ostatus',
array('action' => 'ostatusinit'));
$m->connect('main/ostatus?nickname=:nickname',
@@ -103,6 +103,20 @@ class OStatusPlugin extends Plugin
}
/**
+ * Add a link header for LRDD Discovery
+ */
+ function onStartShowHTML($action)
+ {
+ if ($action instanceof ShowstreamAction) {
+ $acct = 'acct:'. $action->profile->nickname .'@'. common_config('site', 'server');
+ $url = common_local_url('xrd');
+ $url.= '?uri='. $acct;
+
+ header('Link: <'.$url.'>; rel="'. Discovery::LRDD_REL.'"; type="application/xrd+xml"');
+ }
+ }
+
+ /**
* Set up a PuSH hub link to our internal link for canonical timeline
* Atom feeds for users and groups.
*/
@@ -210,7 +224,7 @@ class OStatusPlugin extends Plugin
*
*/
- function onStartFindMentions($sender, $text, &$mentions)
+ function onEndFindMentions($sender, $text, &$mentions)
{
preg_match_all('/(?:^|\s+)@((?:\w+\.)*\w+@(?:\w+\.)*\w+(?:\w+\-\w+)*\.\w+)/',
$text,
@@ -233,11 +247,21 @@ class OStatusPlugin extends Plugin
$this->log(LOG_INFO, "Ostatus_profile found for address '$webfinger'");
+ if ($oprofile->isGroup()) {
+ continue;
+ }
$profile = $oprofile->localProfile();
+ $pos = $wmatch[1];
+ foreach ($mentions as $i => $other) {
+ // If we share a common prefix with a local user, override it!
+ if ($other['position'] == $pos) {
+ unset($mentions[$i]);
+ }
+ }
$mentions[] = array('mentioned' => array($profile),
'text' => $wmatch[0],
- 'position' => $wmatch[1],
+ 'position' => $pos,
'url' => $profile->profileurl);
}
}
@@ -634,7 +658,7 @@ class OStatusPlugin extends Plugin
function onStartUserGroupHomeUrl($group, &$url)
{
- return $this->onStartUserGroupPermalink($group, &$url);
+ return $this->onStartUserGroupPermalink($group, $url);
}
function onStartUserGroupPermalink($group, &$url)