status.net mentions to non-followers require the numeric profile URL, not the nickname profile URL. Though it works when they are a follower.

This commit is contained in:
Friendika 2011-02-26 01:53:18 -08:00
parent 4efa0f1e81
commit 05d3eb59ec
4 changed files with 20 additions and 3 deletions

View file

@ -1941,8 +1941,10 @@ function get_mentions($item) {
$arr = explode(',',$item['tag']); $arr = explode(',',$item['tag']);
foreach($arr as $x) { foreach($arr as $x) {
$matches = null; $matches = null;
if(preg_match('/@\[url=([^\]]*)\]/',$x,$matches)) if(preg_match('/@\[url=([^\]]*)\]/',$x,$matches)) {
$o .= "\t\t" . '<link rel="mentioned" href="' . $matches[1] . '" />' . "\r\n"; $o .= "\t\t" . '<link rel="mentioned" href="' . $matches[1] . '" />' . "\r\n";
$o .= "\t\t" . '<link rel="ostatus:attention" href="' . $matches[1] . '" />' . "\r\n";
}
} }
return $o; return $o;
}} }}

View file

@ -128,7 +128,8 @@ $namespaces = <<< EOT
xmlns:dfrn="http://purl.org/macgirvin/dfrn/1.0" xmlns:dfrn="http://purl.org/macgirvin/dfrn/1.0"
xmlns:as="http://activitystrea.ms/spec/1.0/" xmlns:as="http://activitystrea.ms/spec/1.0/"
xmlns:georss="http://www.georss.org/georss" 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; EOT;
$slap = str_replace('<entry>',$namespaces,$slap); $slap = str_replace('<entry>',$namespaces,$slap);

View file

@ -239,6 +239,7 @@ function item_post(&$a) {
} }
else { else {
$newname = $name; $newname = $name;
$alias = '';
if(strstr($name,'_')) { if(strstr($name,'_')) {
$newname = str_replace('_',' ',$name); $newname = str_replace('_',' ',$name);
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1", $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') { if($r[0]['network'] === 'stat') {
$newname = $r[0]['nick']; $newname = $r[0]['nick'];
$stat = true; $stat = true;
if($r[0]['alias'])
$alias = $r[0]['alias'];
} }
else else
$newname = $r[0]['name']; $newname = $r[0]['name'];
@ -271,6 +274,16 @@ function item_post(&$a) {
if(strlen($str_tags)) if(strlen($str_tags))
$str_tags .= ','; $str_tags .= ',';
$str_tags .= '@[url=' . $profile . ']' . $newname . '[/url]'; $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]';
}
} }
} }
} }

View file

@ -6,7 +6,8 @@
xmlns:dfrn="http://purl.org/macgirvin/dfrn/1.0" xmlns:dfrn="http://purl.org/macgirvin/dfrn/1.0"
xmlns:as="http://activitystrea.ms/spec/1.0/" xmlns:as="http://activitystrea.ms/spec/1.0/"
xmlns:georss="http://www.georss.org/georss" 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" >
<id>$feed_id</id> <id>$feed_id</id>
<title>$feed_title</title> <title>$feed_title</title>