summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/twitapistatuses.php64
1 files changed, 54 insertions, 10 deletions
diff --git a/actions/twitapistatuses.php b/actions/twitapistatuses.php
index 4f2139bc5..3271f1e28 100644
--- a/actions/twitapistatuses.php
+++ b/actions/twitapistatuses.php
@@ -57,7 +57,22 @@ class TwitapistatusesAction extends TwitterapiAction {
// FIXME: To really live up to the spec we need to build a list
// of notices by users who have custom avatars, so fix this SQL -- Zach
- $notice = Notice::publicStream(0, $MAX_PUBSTATUSES);
+ $page = $this->arg('page');
+ $since_id = $this->arg('since_id');
+ $before_id = $this->arg('before_id');
+
+ // NOTE: page, since_id, and before_id are extensions to Twitter API -- TB
+ if (!$page) {
+ $page = 1;
+ }
+ if (!$since_id) {
+ $since_id = 0;
+ }
+ if (!$before_id) {
+ $before_id = 0;
+ }
+
+ $notice = Notice::publicStream((($page-1)*$MAX_PUBSTATUSES), $MAX_PUBSTATUSES, $since_id, $before_id);
if ($notice) {
@@ -112,16 +127,26 @@ class TwitapistatusesAction extends TwitterapiAction {
$since = $this->arg('since');
$since_id = $this->arg('since_id');
$count = $this->arg('count');
- $page = $this->arg('page');
+ $page = $this->arg('page');
+ $before_id = $this->arg('before_id');
- if (!$page) {
- $page = 1;
- }
+ if (!$page) {
+ $page = 1;
+ }
if (!$count) {
$count = 20;
}
+ if (!$since_id) {
+ $since_id = 0;
+ }
+
+ // NOTE: before_id is an extensions to Twitter API -- TB
+ if (!$before_id) {
+ $before_id = 0;
+ }
+
$user = $this->get_user($id, $apidata);
$profile = $user->getProfile();
@@ -133,7 +158,7 @@ class TwitapistatusesAction extends TwitterapiAction {
$link = common_local_url('all', array('nickname' => $user->nickname));
$subtitle = sprintf(_('Updates from %1$s and friends on %2$s!'), $user->nickname, $sitename);
- $notice = $user->noticesWithFriends(($page-1)*20, $count);
+ $notice = $user->noticesWithFriends(($page-1)*20, $count, $since_id, $before_id);
switch($apidata['content-type']) {
case 'xml':
@@ -215,8 +240,9 @@ class TwitapistatusesAction extends TwitterapiAction {
$count = $this->arg('count');
$since = $this->arg('since');
- $since_id = $this->arg('since_id');
+ $since_id = $this->arg('since_id');
$page = $this->arg('page');
+ $before_id = $this->arg('before_id');
if (!$page) {
$page = 1;
@@ -226,6 +252,15 @@ class TwitapistatusesAction extends TwitterapiAction {
$count = 20;
}
+ if (!$since_id) {
+ $since_id = 0;
+ }
+
+ // NOTE: before_id is an extensions to Twitter API -- TB
+ if (!$before_id) {
+ $before_id = 0;
+ }
+
$sitename = common_config('site', 'name');
$siteserver = common_config('site', 'server');
@@ -235,9 +270,8 @@ class TwitapistatusesAction extends TwitterapiAction {
$subtitle = sprintf(_('Updates from %1$s on %2$s!'), $user->nickname, $sitename);
# XXX: since
- # XXX: since_id
- $notice = $user->getNotices((($page-1)*20), $count);
+ $notice = $user->getNotices((($page-1)*20), $count, $since_id, $before_id);
switch($apidata['content-type']) {
case 'xml':
@@ -354,6 +388,8 @@ class TwitapistatusesAction extends TwitterapiAction {
$count = $this->arg('count');
$page = $this->arg('page');
+ $since_id = $this->arg('since_id');
+ $before_id = $this->arg('before_id');
$user = $apidata['user'];
$profile = $user->getProfile();
@@ -374,7 +410,15 @@ class TwitapistatusesAction extends TwitterapiAction {
$count = 20;
}
- $notice = $user->getReplies((($page-1)*20), $count);
+ if (!$since_id) {
+ $since_id = 0;
+ }
+
+ // NOTE: before_id is an extensions to Twitter API -- TB
+ if (!$before_id) {
+ $before_id = 0;
+ }
+ $notice = $user->getReplies((($page-1)*20), $count, $since_id, $before_id);
$notices = array();
while ($notice->fetch()) {