Twitter-compatible API - added source links to statuses/notices

darcs-hash:20080930175354-462f3-b49bef0e1b91ef1b94c01426c4c54900a43554d3.gz
This commit is contained in:
zach 2008-09-30 13:53:54 -04:00
parent 924491f08a
commit bbd5f6b471

View File

@ -61,7 +61,7 @@ class TwitterapiAction extends Action {
$twitter_status['truncated'] = 'false'; # Not possible on Laconica
$twitter_status['created_at'] = $this->date_twitter($notice->created);
$twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ? intval($notice->reply_to) : NULL;
$twitter_status['source'] = $notice->source;
$twitter_status['source'] = $this->source_link($notice->source);
$twitter_status['id'] = intval($notice->id);
$twitter_status['in_reply_to_user_id'] = ($notice->reply_to) ? $this->replier_by_reply(intval($notice->reply_to)) : NULL;
$twitter_status['favorited'] = NULL; # XXX: Not implemented on Laconica yet.
@ -441,4 +441,23 @@ class TwitterapiAction extends Action {
}
}
function source_link($source) {
$source_name = _($source);
switch ($source) {
case 'web':
case 'xmpp':
case 'mail':
case 'omb':
case 'api':
break;
default:
$ns = Notice_source::staticGet($source);
if ($ns) {
$source_name = '<a href="' . $ns->url . '">' . $ns->name . '</a>';
}
break;
}
return $source_name;
}
}