From bbd5f6b471c873e9fff955bfbedd3db91ee25dc0 Mon Sep 17 00:00:00 2001 From: zach Date: Tue, 30 Sep 2008 13:53:54 -0400 Subject: [PATCH] Twitter-compatible API - added source links to statuses/notices darcs-hash:20080930175354-462f3-b49bef0e1b91ef1b94c01426c4c54900a43554d3.gz --- lib/twitterapi.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/twitterapi.php b/lib/twitterapi.php index 5bcb538f9f..c8d78e1a37 100644 --- a/lib/twitterapi.php +++ b/lib/twitterapi.php @@ -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 = '' . $ns->name . ''; + } + break; + } + return $source_name; + } + } \ No newline at end of file