OStatus: fix salmon link on Atom feeds; add a url spec for group feeds as well (endpoint needs impl)

This commit is contained in:
Brion Vibber 2010-02-11 20:02:17 +00:00
parent 20714d1f35
commit 21bfbc43ad

View File

@ -80,6 +80,9 @@ class OStatusPlugin extends Plugin
$m->connect('main/salmon/user/:id',
array('action' => 'salmon'),
array('id' => '[0-9]+'));
$m->connect('main/salmon/group/:id',
array('action' => 'salmongroup'),
array('id' => '[0-9]+'));
return true;
}
@ -111,7 +114,14 @@ class OStatusPlugin extends Plugin
*/
function onStartApiAtom(Action $action)
{
if ($action instanceof ApiTimelineUserAction || $action instanceof ApiTimelineGroupAction) {
if ($action instanceof ApiTimelineUserAction) {
$salmonAction = 'salmon';
} else if ($action instanceof ApiTimelineGroupAction) {
$salmonAction = 'salmongroup';
} else {
return;
}
$id = $action->arg('id');
if (strval(intval($id)) === strval($id)) {
// Canonical form of id in URL? These are used for OStatus syndication.
@ -125,12 +135,11 @@ class OStatusPlugin extends Plugin
'href' => $hub));
// Also, we'll add in the salmon link
$salmon = common_local_url($salmonAction, array('id' => $id));
$action->element('link', array('rel' => 'salmon',
'href' => common_local_url('salmon')));
'href' => $salmon));
}
}
return true;
}
/**
* Add the feed settings page to the Connect Settings menu
@ -191,14 +200,17 @@ class OStatusPlugin extends Plugin
array('nickname' => $profile->nickname));
$output->element('a', array('href' => $url,
'class' => 'entity_remote_subscribe'),
_('OStatus'));
_m('OStatus'));
$output->elementEnd('li');
}
}
/**
* Check if we've got some Salmon stuff to send
* Check if we've got remote replies to send via Salmon.
*
* @fixme push webfinger lookup & sending to a background queue
* @fixme also detect short-form name for remote subscribees where not ambiguous
*/
function onEndNoticeSave($notice)
{
@ -234,7 +246,6 @@ class OStatusPlugin extends Plugin
}
}
/**
* Garbage collect unused feeds on unsubscribe
*/
@ -253,7 +264,9 @@ class OStatusPlugin extends Plugin
return true;
}
/**
* Make sure necessary tables are filled out.
*/
function onCheckSchema() {
$schema = Schema::get();
$schema->ensureTable('feedinfo', Feedinfo::schemaDef());