Twitter-compatible API - rss and atom feeds for direct messages

darcs-hash:20080926012015-7b5ce-da94465ff9c027183e0e674b6152902c302d0131.gz
This commit is contained in:
Zach Copley
2008-09-25 21:20:15 -04:00
parent d687f16525
commit 10f4ee7abb
3 changed files with 112 additions and 30 deletions

View File

@@ -85,9 +85,9 @@ class TwitterapiAction extends Action {
$entry['content'] = $profile->nickname . ': ' . $notice->content;
$entry['title'] = $entry['content'];
$entry['link'] = common_local_url('shownotice', array('notice' => $notice->id));;
$entry['link'] = common_local_url('shownotice', array('notice' => $notice->id));
$entry['published'] = common_date_iso8601($notice->created);
$entry['id'] = "tag:$server,$entry[published]:$entry[link]";
$entry['id'] = "tag:$server,2008:$entry[link]";
$entry['updated'] = $entry['published'];
# RSS Item specific
@@ -98,6 +98,29 @@ class TwitterapiAction extends Action {
return $entry;
}
function twitter_rss_dmsg_array($message) {
$server = common_config('site', 'server');
$entry = array();
$entry['title'] = sprintf('Message from %s to %s',
$message->getFrom()->nickname, $message->getTo()->nickname);
$entry['content'] = $message->content;
$entry['link'] = $message->uri;
$entry['published'] = common_date_iso8601($message->created);
$entry['id'] = "tag:$server,2008:$entry[link]";
$entry['updated'] = $entry['published'];
# RSS Item specific
$entry['description'] = $message->content;
$entry['pubDate'] = common_date_rfc2822($message->created);
$entry['guid'] = $entry['link'];
return $entry;
}
function twitter_dm_array($message) {
$twitter_dm = array();