diff options
author | Zach Copley <zach@controlyourself.ca> | 2008-09-25 21:20:15 -0400 |
---|---|---|
committer | Zach Copley <zach@controlyourself.ca> | 2008-09-25 21:20:15 -0400 |
commit | 10f4ee7abb889aeb21b45efb563ebe5c2f4d9c94 (patch) | |
tree | 1143bcce438ded1e6f96abb123b5bf1b7babf375 /lib/twitterapi.php | |
parent | d687f16525307b89c99c6fc0fb3f78e30095ae7d (diff) |
Twitter-compatible API - rss and atom feeds for direct messages
darcs-hash:20080926012015-7b5ce-da94465ff9c027183e0e674b6152902c302d0131.gz
Diffstat (limited to 'lib/twitterapi.php')
-rw-r--r-- | lib/twitterapi.php | 27 |
1 files changed, 25 insertions, 2 deletions
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(); |