$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;
}
*/
function onStartApiAtom(Action $action)
{
- if ($action instanceof ApiTimelineUserAction || $action instanceof ApiTimelineGroupAction) {
- $id = $action->arg('id');
- if (strval(intval($id)) === strval($id)) {
- // Canonical form of id in URL? These are used for OStatus syndication.
+ if ($action instanceof ApiTimelineUserAction) {
+ $salmonAction = 'salmon';
+ } else if ($action instanceof ApiTimelineGroupAction) {
+ $salmonAction = 'salmongroup';
+ } else {
+ return;
+ }
- $hub = common_config('ostatus', 'hub');
- if (empty($hub)) {
- // Updates will be handled through our internal PuSH hub.
- $hub = common_local_url('pushhub');
- }
- $action->element('link', array('rel' => 'hub',
- 'href' => $hub));
+ $id = $action->arg('id');
+ if (strval(intval($id)) === strval($id)) {
+ // Canonical form of id in URL? These are used for OStatus syndication.
- // Also, we'll add in the salmon link
- $action->element('link', array('rel' => 'salmon',
- 'href' => common_local_url('salmon')));
+ $hub = common_config('ostatus', 'hub');
+ if (empty($hub)) {
+ // Updates will be handled through our internal PuSH hub.
+ $hub = common_local_url('pushhub');
}
+ $action->element('link', array('rel' => 'hub',
+ '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' => $salmon));
}
- return true;
}
/**
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)
{
}
}
}
-
/**
* Garbage collect unused feeds on unsubscribe
return true;
}
-
+ /**
+ * Make sure necessary tables are filled out.
+ */
function onCheckSchema() {
$schema = Schema::get();
$schema->ensureTable('feedinfo', Feedinfo::schemaDef());