Salmon only has one "rel" value now, so start deprecating

This commit is contained in:
Mikael Nordfeldth 2013-11-01 17:00:12 +01:00
parent bd86519d50
commit 7ddd561837
4 changed files with 15 additions and 7 deletions

View File

@ -174,7 +174,7 @@ class OStatusPlugin extends Plugin
$salmon = common_local_url($salmonAction, array('id' => $id)); $salmon = common_local_url($salmonAction, array('id' => $id));
$feed->addLink($salmon, array('rel' => Salmon::REL_SALMON)); $feed->addLink($salmon, array('rel' => Salmon::REL_SALMON));
// XXX: these are deprecated // XXX: these are deprecated, but StatusNet only looks for NS_REPLIES
$feed->addLink($salmon, array('rel' => Salmon::NS_REPLIES)); $feed->addLink($salmon, array('rel' => Salmon::NS_REPLIES));
$feed->addLink($salmon, array('rel' => Salmon::NS_MENTIONS)); $feed->addLink($salmon, array('rel' => Salmon::NS_MENTIONS));
} }
@ -1323,7 +1323,8 @@ class OStatusPlugin extends Plugin
array('id' => $target->id)); array('id' => $target->id));
$xrd->links[] = new XML_XRD_Element_Link(Salmon::REL_SALMON, $salmon_url); $xrd->links[] = new XML_XRD_Element_Link(Salmon::REL_SALMON, $salmon_url);
// XXX : Deprecated - to be removed.
// XXX: these are deprecated, but StatusNet only looks for NS_REPLIES
$xrd->links[] = new XML_XRD_Element_Link(Salmon::NS_REPLIES, $salmon_url); $xrd->links[] = new XML_XRD_Element_Link(Salmon::NS_REPLIES, $salmon_url);
$xrd->links[] = new XML_XRD_Element_Link(Salmon::NS_MENTIONS, $salmon_url); $xrd->links[] = new XML_XRD_Element_Link(Salmon::NS_MENTIONS, $salmon_url);

View File

@ -1110,7 +1110,10 @@ class Ostatus_profile extends Managed_DataObject
$huburi = $discover->getHubLink(); $huburi = $discover->getHubLink();
$hints['hub'] = $huburi; $hints['hub'] = $huburi;
$salmonuri = $discover->getAtomLink(Salmon::NS_REPLIES);
// XXX: NS_REPLIES is deprecated anyway, so let's remove it in the future.
$salmonuri = $discover->getAtomLink(Salmon::REL_SALMON)
?: $discover->getAtomLink(Salmon::NS_REPLIES);
$hints['salmon'] = $salmonuri; $hints['salmon'] = $salmonuri;
if (!$huburi && !common_config('feedsub', 'fallback_hub')) { if (!$huburi && !common_config('feedsub', 'fallback_hub')) {
@ -1489,7 +1492,9 @@ class Ostatus_profile extends Managed_DataObject
$discover = new FeedDiscovery(); $discover = new FeedDiscovery();
$discover->discoverFromFeedURL($hints['feedurl']); $discover->discoverFromFeedURL($hints['feedurl']);
} }
$salmonuri = $discover->getAtomLink(Salmon::NS_REPLIES); // XXX: NS_REPLIES is deprecated anyway, so let's remove it in the future.
$salmonuri = $discover->getAtomLink(Salmon::REL_SALMON)
?: $discover->getAtomLink(Salmon::NS_REPLIES);
} }
if (array_key_exists('hub', $hints)) { if (array_key_exists('hub', $hints)) {

View File

@ -29,8 +29,9 @@ class DiscoveryHints {
case WebFingerResource::PROFILEPAGE: case WebFingerResource::PROFILEPAGE:
$hints['profileurl'] = $link->href; $hints['profileurl'] = $link->href;
break; break;
case Salmon::NS_MENTIONS: case Salmon::REL_SALMON:
case Salmon::NS_REPLIES: case Salmon::NS_MENTIONS: // XXX: deprecated, remove in the future
case Salmon::NS_REPLIES: // XXX: deprecated, remove in the future
$hints['salmon'] = $link->href; $hints['salmon'] = $link->href;
break; break;
case Discovery::UPDATESFROM: case Discovery::UPDATESFROM:

View File

@ -56,7 +56,8 @@ print "Re-running feed discovery for profile URL $oprofile->uri\n";
$discover = new FeedDiscovery(); $discover = new FeedDiscovery();
$feedurl = $discover->discoverFromURL($oprofile->uri); $feedurl = $discover->discoverFromURL($oprofile->uri);
$huburi = $discover->getHubLink(); $huburi = $discover->getHubLink();
$salmonuri = $discover->getAtomLink(Salmon::NS_REPLIES); $salmonuri = $discover->getAtomLink(Salmon::REL_SALMON)
?: $discover->getAtomLink(Salmon::NS_REPLIES);
print " Feed URL: $feedurl\n"; print " Feed URL: $feedurl\n";
print " Hub URL: $huburi\n"; print " Hub URL: $huburi\n";