From 05d3eb59ecdaf757dd2822a65a13b72311307a72 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sat, 26 Feb 2011 01:53:18 -0800 Subject: [PATCH] status.net mentions to non-followers require the numeric profile URL, not the nickname profile URL. Though it works when they are a follower. --- boot.php | 4 +++- include/salmon.php | 3 ++- mod/item.php | 13 +++++++++++++ view/atom_feed.tpl | 3 ++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/boot.php b/boot.php index 4a0acef936..06cf5b7605 100644 --- a/boot.php +++ b/boot.php @@ -1941,8 +1941,10 @@ function get_mentions($item) { $arr = explode(',',$item['tag']); foreach($arr as $x) { $matches = null; - if(preg_match('/@\[url=([^\]]*)\]/',$x,$matches)) + if(preg_match('/@\[url=([^\]]*)\]/',$x,$matches)) { $o .= "\t\t" . '' . "\r\n"; + $o .= "\t\t" . '' . "\r\n"; + } } return $o; }} diff --git a/include/salmon.php b/include/salmon.php index 8a56882adb..b5c21a87b5 100644 --- a/include/salmon.php +++ b/include/salmon.php @@ -128,7 +128,8 @@ $namespaces = <<< EOT xmlns:dfrn="http://purl.org/macgirvin/dfrn/1.0" xmlns:as="http://activitystrea.ms/spec/1.0/" xmlns:georss="http://www.georss.org/georss" - xmlns:poco="http://portablecontacts.net/spec/1.0" > + xmlns:poco="http://portablecontacts.net/spec/1.0" + xmlns:ostatus="http://ostatus.org/schema/1.0" > EOT; $slap = str_replace('',$namespaces,$slap); diff --git a/mod/item.php b/mod/item.php index c2487435e4..5989d09674 100644 --- a/mod/item.php +++ b/mod/item.php @@ -239,6 +239,7 @@ function item_post(&$a) { } else { $newname = $name; + $alias = ''; if(strstr($name,'_')) { $newname = str_replace('_',' ',$name); $r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1", @@ -257,6 +258,8 @@ function item_post(&$a) { if($r[0]['network'] === 'stat') { $newname = $r[0]['nick']; $stat = true; + if($r[0]['alias']) + $alias = $r[0]['alias']; } else $newname = $r[0]['name']; @@ -271,6 +274,16 @@ function item_post(&$a) { if(strlen($str_tags)) $str_tags .= ','; $str_tags .= '@[url=' . $profile . ']' . $newname . '[/url]'; + + // Status.Net seems to require the numeric ID URL in a mention if the person isn't + // subscribed to you. But the nickname URL is OK if they are. Grrr. We'll tag both. + + if(strlen($alias)) { + if(strlen($str_tags)) + $str_tags .= ','; + $str_tags .= '@[url=' . $alias . ']' . $newname . '[/url]'; + } + } } } diff --git a/view/atom_feed.tpl b/view/atom_feed.tpl index e59b20ab1c..686c256ed9 100644 --- a/view/atom_feed.tpl +++ b/view/atom_feed.tpl @@ -6,7 +6,8 @@ xmlns:dfrn="http://purl.org/macgirvin/dfrn/1.0" xmlns:as="http://activitystrea.ms/spec/1.0/" xmlns:georss="http://www.georss.org/georss" - xmlns:poco="http://portablecontacts.net/spec/1.0" > + xmlns:poco="http://portablecontacts.net/spec/1.0" + xmlns:ostatus="http://ostatus.org/schema/1.0" > $feed_id $feed_title