*/
function friends($args, $apidata) {
parent::handle($args);
- return $this->subscriptions('subscribed', 'subscriber');
+ return $this->subscriptions($apidata, 'subscribed', 'subscriber');
}
/*
function followers($args, $apidata) {
parent::handle($args);
- return $this->subscriptions('subscriber', 'subscribed');
+ return $this->subscriptions($apidata, 'subscriber', 'subscribed');
}
-
- function subscriptions($other_attr, $user_attr) {
- $user = null;
+
+ function subscriptions($apidata, $other_attr, $user_attr) {
- // function was called with an argument /statuses/user_timeline/api_arg.format
- if (isset($apidata['api_arg'])) {
+ $user = $this->get_subs_user($apidata);
+
+ # XXX: id
+ # XXX: page
+ # XXX: lite
- if (is_numeric($apidata['api_arg'])) {
- $user = User::staticGet($apidata['api_arg']);
- } else {
- $nickname = common_canonical_nickname($apidata['api_arg']);
- $user = User::staticGet('nickname', $nickname);
- }
- } else {
-
- // if no user was specified, then we'll use the authenticated user
- $user = $apidata['user'];
- }
-
- if (!$user) {
- // Set the user to be the auth user if asked-for can't be found
- // honestly! This is what Twitter does, I swear --Zach
- $user = $apidata['user'];
- }
-
$profile = $user->getProfile();
if (!$profile) {
exit();
}
+ function get_subs_user($apidata) {
+
+ // function was called with an argument /statuses/user_timeline/api_arg.format
+ if (isset($apidata['api_arg'])) {
+
+ if (is_numeric($apidata['api_arg'])) {
+ $user = User::staticGet($apidata['api_arg']);
+ } else {
+ $nickname = common_canonical_nickname($apidata['api_arg']);
+ $user = User::staticGet('nickname', $nickname);
+ }
+ } else {
+
+ // if no user was specified, then we'll use the authenticated user
+ $user = $apidata['user'];
+ }
+
+ if (!$user) {
+ // Set the user to be the auth user if asked-for can't be found
+ // honestly! This is what Twitter does, I swear --Zach
+ $user = $apidata['user'];
+ }
+
+ return $user;
+ }
+
function show_profiles($profiles, $type) {
switch ($type) {
case 'xml':