X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Ftwitapistatuses.php;h=63e29068b140897da4e8d0eb5ffd72b4766b4516;hb=f87ef9b72b8e054296a3fd37c74f07af5f6a6c38;hp=a35f4b12eaa4f1d3f25c4a41628e1bc1260a2c1d;hpb=1a02d681fa1de7c2daed2ecc951f4c9bf1c13976;p=quix0rs-gnu-social.git diff --git a/actions/twitapistatuses.php b/actions/twitapistatuses.php index a35f4b12ea..63e29068b1 100644 --- a/actions/twitapistatuses.php +++ b/actions/twitapistatuses.php @@ -115,9 +115,14 @@ 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; + if (empty($user)) { + $this->clientError(_('No such user!'), 404, $apidata['content-type']); + return; + } + $profile = $user->getProfile(); $sitename = common_config('site', 'name'); @@ -204,7 +209,7 @@ class TwitapistatusesAction extends TwitterapiAction # FriendFeed's SUP protocol # Also added RSS and Atom feeds - $suplink = common_local_url('sup', null, $user->id); + $suplink = common_local_url('sup', null, null, $user->id); header('X-SUP-ID: '.$suplink); # XXX: since @@ -450,7 +455,6 @@ class TwitapistatusesAction extends TwitterapiAction if ($user->id == $notice->profile_id) { $replies = new Reply; $replies->get('notice_id', $notice_id); - common_dequeue_notice($notice); $replies->delete(); $notice->delete(); @@ -471,19 +475,28 @@ class TwitapistatusesAction extends TwitterapiAction return $this->subscriptions($apidata, 'subscribed', 'subscriber'); } - function followers($args, $apidata) + function friendsIDs($args, $apidata) { parent::handle($args); + return $this->subscriptions($apidata, 'subscribed', 'subscriber', true); + } + function followers($args, $apidata) + { + parent::handle($args); return $this->subscriptions($apidata, 'subscriber', 'subscribed'); } - function subscriptions($apidata, $other_attr, $user_attr) + function followersIDs($args, $apidata) { + parent::handle($args); + return $this->subscriptions($apidata, 'subscriber', 'subscribed', true); + } - # XXX: lite + function subscriptions($apidata, $other_attr, $user_attr, $onlyIDs=false) + { - $this->auth_user = $apidate['user']; + $this->auth_user = $apidata['user']; $user = $this->get_user($apidata['api_arg'], $apidata); if (!$user) { @@ -515,7 +528,10 @@ class TwitapistatusesAction extends TwitterapiAction } $sub->orderBy('created DESC'); - $sub->limit(($page-1)*100, 100); + + if (!$onlyIDs) { + $sub->limit(($page-1)*100, 100); + } $others = array(); @@ -530,7 +546,13 @@ class TwitapistatusesAction extends TwitterapiAction $type = $apidata['content-type']; $this->init_document($type); - $this->show_profiles($others, $type); + + if ($onlyIDs) { + $this->showIDs($others, $type); + } else { + $this->show_profiles($others, $type); + } + $this->end_document($type); } @@ -556,6 +578,28 @@ class TwitapistatusesAction extends TwitterapiAction } } + function showIDs($profiles, $type) + { + switch ($type) { + case 'xml': + $this->elementStart('ids'); + foreach ($profiles as $profile) { + $this->element('id', null, $profile->id); + } + $this->elementEnd('ids'); + break; + case 'json': + $ids = array(); + foreach ($profiles as $profile) { + $ids[] = (int)$profile->id; + } + print json_encode($ids); + break; + default: + $this->clientError(_('unsupported file type')); + } + } + function featured($args, $apidata) { parent::handle($args);