diff options
author | zach <zach@copley.name> | 2008-07-16 16:52:18 -0400 |
---|---|---|
committer | zach <zach@copley.name> | 2008-07-16 16:52:18 -0400 |
commit | fba25b0d9810dac55a27feed173437a2a2f61364 (patch) | |
tree | fd0a33449455ecece959404d76b3112aea548edd /actions/twitapistatuses.php | |
parent | c998c7c60180cecbb55435629307de6f00bd637b (diff) |
Twitter-compatible API: public_timeline.atom works
darcs-hash:20080716205218-ca946-98e53e29ed364ea4254ed90303c04b93511877f9.gz
Diffstat (limited to 'actions/twitapistatuses.php')
-rw-r--r-- | actions/twitapistatuses.php | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/actions/twitapistatuses.php b/actions/twitapistatuses.php index 3a495a129..f9b804bd1 100644 --- a/actions/twitapistatuses.php +++ b/actions/twitapistatuses.php @@ -101,7 +101,33 @@ class TwitapistatusesAction extends TwitterapiAction { $this->end_twitter_rss(); } elseif ($apidata['content-type'] == 'atom') { - common_server_error("API method under construction.", $code=501); + + header('Content-Type: application/atom+xml; charset=utf-8'); + + $this->init_twitter_atom(); + + $sitename = common_config('site', 'name'); + $siteserver = common_config('site', 'server'); + + common_element('title', NULL, "$sitename public timeline"); + common_element('id', NULL, "tag:$siteserver:Statuses"); + common_element('link', array('href' => "http://$siteserver", 'rel' => 'alternate', 'type' => 'text/html'), NULL); + common_element('subtitle', NULL, "$sitename updates from everyone!"); + + if ($cnt > 0) { + for ($i = 0; $i < 20; $i++) { + if ($notice->fetch()) { + $entry = $this->twitter_rss_entry_array($notice); + $this->show_twitter_atom_entry($entry); + } else { + // shouldn't happen! + break; + } + } + } + + $this->end_twitter_atom(); + } elseif ($apidata['content-type'] == 'json') { header('Content-Type: application/json; charset=utf-8'); |