summaryrefslogtreecommitdiff
path: root/actions/twitapistatuses.php
diff options
context:
space:
mode:
Diffstat (limited to 'actions/twitapistatuses.php')
-rw-r--r--actions/twitapistatuses.php62
1 files changed, 43 insertions, 19 deletions
diff --git a/actions/twitapistatuses.php b/actions/twitapistatuses.php
index 216835026..323c4f1f8 100644
--- a/actions/twitapistatuses.php
+++ b/actions/twitapistatuses.php
@@ -29,10 +29,12 @@ class TwitapistatusesAction extends TwitterapiAction
parent::handle($args);
$sitename = common_config('site', 'name');
- $siteserver = common_config('site', 'server');
$title = sprintf(_("%s public timeline"), $sitename);
- $id = "tag:$siteserver:Statuses";
+
+ $taguribase = common_config('integration', 'taguri');
+ $id = "tag:$taguribase:PublicTimeline";
$link = common_root_url();
+
$subtitle = sprintf(_("%s updates from everyone!"), $sitename);
// Number of public statuses to return by default -- Twitter sends 20
@@ -70,7 +72,8 @@ class TwitapistatusesAction extends TwitterapiAction
$this->show_rss_timeline($notice, $title, $link, $subtitle);
break;
case 'atom':
- $this->show_atom_timeline($notice, $title, $id, $link, $subtitle);
+ $selfuri = common_root_url() . 'api/statuses/public_timeline.atom';
+ $this->show_atom_timeline($notice, $title, $id, $link, $subtitle, null, $selfuri);
break;
case 'json':
$this->show_json_timeline($notice);
@@ -114,17 +117,19 @@ class TwitapistatusesAction extends TwitterapiAction
}
$since = strtotime($this->arg('since'));
-
- $user = $this->get_user(null, $apidata);
+ $user = $this->get_user($apidata['api_arg'], $apidata);
$this->auth_user = $user;
- $profile = $user->getProfile();
+ if (empty($user)) {
+ $this->clientError(_('No such user!'), 404, $apidata['content-type']);
+ return;
+ }
+ $profile = $user->getProfile();
$sitename = common_config('site', 'name');
- $siteserver = common_config('site', 'server');
-
$title = sprintf(_("%s and friends"), $user->nickname);
- $id = "tag:$siteserver:friends:" . $user->id;
+ $taguribase = common_config('integration', 'taguri');
+ $id = "tag:$taguribase:FriendsTimeline:" . $user->id;
$link = common_local_url('all', array('nickname' => $user->nickname));
$subtitle = sprintf(_('Updates from %1$s and friends on %2$s!'), $user->nickname, $sitename);
@@ -138,7 +143,14 @@ class TwitapistatusesAction extends TwitterapiAction
$this->show_rss_timeline($notice, $title, $link, $subtitle);
break;
case 'atom':
- $this->show_atom_timeline($notice, $title, $id, $link, $subtitle);
+ if (isset($apidata['api_arg'])) {
+ $selfuri = $selfuri = common_root_url() .
+ 'api/statuses/friends_timeline/' . $apidata['api_arg'] . '.atom';
+ } else {
+ $selfuri = $selfuri = common_root_url() .
+ 'api/statuses/friends_timeline.atom';
+ }
+ $this->show_atom_timeline($notice, $title, $id, $link, $subtitle, null, $selfuri);
break;
case 'json':
$this->show_json_timeline($notice);
@@ -194,10 +206,9 @@ class TwitapistatusesAction extends TwitterapiAction
$since = strtotime($this->arg('since'));
$sitename = common_config('site', 'name');
- $siteserver = common_config('site', 'server');
-
$title = sprintf(_("%s timeline"), $user->nickname);
- $id = "tag:$siteserver:user:".$user->id;
+ $taguribase = common_config('integration', 'taguri');
+ $id = "tag:$taguribase:UserTimeline:".$user->id;
$link = common_local_url('showstream', array('nickname' => $user->nickname));
$subtitle = sprintf(_('Updates from %1$s on %2$s!'), $user->nickname, $sitename);
@@ -219,7 +230,14 @@ class TwitapistatusesAction extends TwitterapiAction
$this->show_rss_timeline($notice, $title, $link, $subtitle, $suplink);
break;
case 'atom':
- $this->show_atom_timeline($notice, $title, $id, $link, $subtitle, $suplink);
+ if (isset($apidata['api_arg'])) {
+ $selfuri = $selfuri = common_root_url() .
+ 'api/statuses/user_timeline/' . $apidata['api_arg'] . '.atom';
+ } else {
+ $selfuri = $selfuri = common_root_url() .
+ 'api/statuses/user_timeline.atom';
+ }
+ $this->show_atom_timeline($notice, $title, $id, $link, $subtitle, $suplink, $selfuri);
break;
case 'json':
$this->show_json_timeline($notice);
@@ -337,15 +355,14 @@ class TwitapistatusesAction extends TwitterapiAction
$since_id = $this->arg('since_id');
$before_id = $this->arg('before_id');
+ $user = $this->get_user($apidata['api_arg'], $apidata);
$this->auth_user = $apidata['user'];
- $user = $this->auth_user;
$profile = $user->getProfile();
$sitename = common_config('site', 'name');
- $siteserver = common_config('site', 'server');
-
$title = sprintf(_('%1$s / Updates replying to %2$s'), $sitename, $user->nickname);
- $id = "tag:$siteserver:replies:".$user->id;
+ $taguribase = common_config('integration', 'taguri');
+ $id = "tag:$taguribase:Replies:".$user->id;
$link = common_local_url('replies', array('nickname' => $user->nickname));
$subtitle = sprintf(_('%1$s updates that reply to updates from %2$s / %3$s.'), $sitename, $user->nickname, $profile->getBestName());
@@ -383,7 +400,14 @@ class TwitapistatusesAction extends TwitterapiAction
$this->show_rss_timeline($notices, $title, $link, $subtitle);
break;
case 'atom':
- $this->show_atom_timeline($notices, $title, $id, $link, $subtitle);
+ if (isset($apidata['api_arg'])) {
+ $selfuri = $selfuri = common_root_url() .
+ 'api/statuses/replies/' . $apidata['api_arg'] . '.atom';
+ } else {
+ $selfuri = $selfuri = common_root_url() .
+ 'api/statuses/replies.atom';
+ }
+ $this->show_atom_timeline($notices, $title, $id, $link, $subtitle, null, $selfuri);
break;
case 'json':
$this->show_json_timeline($notices);