From 10f4ee7abb889aeb21b45efb563ebe5c2f4d9c94 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 25 Sep 2008 21:20:15 -0400 Subject: Twitter-compatible API - rss and atom feeds for direct messages darcs-hash:20080926012015-7b5ce-da94465ff9c027183e0e674b6152902c302d0131.gz --- lib/twitterapi.php | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'lib/twitterapi.php') diff --git a/lib/twitterapi.php b/lib/twitterapi.php index 2dd068a92..d427a7b4e 100644 --- a/lib/twitterapi.php +++ b/lib/twitterapi.php @@ -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(); -- cgit v1.2.3-54-g00ecf