]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Support the 'lite' parameter to statuses/friends and statuses/followers twitter api...
authorCraig Andrews <candrews@integralblue.com>
Thu, 6 Aug 2009 19:14:27 +0000 (15:14 -0400)
committerCraig Andrews <candrews@integralblue.com>
Thu, 6 Aug 2009 19:14:27 +0000 (15:14 -0400)
http://laconi.ca/trac/ticket/1786

actions/twitapistatuses.php
lib/twitterapi.php

index c9943698dc2bc06510c2d5bafdf506e7e6b6ba43..185129d5eee91f2634a8d613f29da8f80066ad70 100644 (file)
@@ -449,7 +449,8 @@ class TwitapistatusesAction extends TwitterapiAction
     function friends($args, $apidata)
     {
         parent::handle($args);
-        return $this->subscriptions($apidata, 'subscribed', 'subscriber');
+        $includeStatuses=! (boolean) $args['lite'];
+        return $this->subscriptions($apidata, 'subscribed', 'subscriber', false, $includeStatuses);
     }
 
     function friendsIDs($args, $apidata)
@@ -461,7 +462,8 @@ class TwitapistatusesAction extends TwitterapiAction
     function followers($args, $apidata)
     {
         parent::handle($args);
-        return $this->subscriptions($apidata, 'subscriber', 'subscribed');
+        $includeStatuses=! (boolean) $args['lite'];
+        return $this->subscriptions($apidata, 'subscriber', 'subscribed', false, $includeStatuses);
     }
 
     function followersIDs($args, $apidata)
@@ -470,7 +472,7 @@ class TwitapistatusesAction extends TwitterapiAction
         return $this->subscriptions($apidata, 'subscriber', 'subscribed', true);
     }
 
-    function subscriptions($apidata, $other_attr, $user_attr, $onlyIDs=false)
+    function subscriptions($apidata, $other_attr, $user_attr, $onlyIDs=false, $includeStatuses=true)
     {
         $this->auth_user = $apidata['user'];
         $user = $this->get_user($apidata['api_arg'], $apidata);
@@ -526,26 +528,26 @@ class TwitapistatusesAction extends TwitterapiAction
         if ($onlyIDs) {
             $this->showIDs($others, $type);
         } else {
-            $this->show_profiles($others, $type);
+            $this->show_profiles($others, $type, $includeStatuses);
         }
 
         $this->end_document($type);
     }
 
-    function show_profiles($profiles, $type)
+    function show_profiles($profiles, $type, $includeStatuses)
     {
         switch ($type) {
         case 'xml':
             $this->elementStart('users', array('type' => 'array'));
             foreach ($profiles as $profile) {
-                $this->show_profile($profile);
+                $this->show_profile($profile,$type,null,$includeStatuses);
             }
             $this->elementEnd('users');
             break;
         case 'json':
             $arrays = array();
             foreach ($profiles as $profile) {
-                $arrays[] = $this->twitter_user_array($profile, true);
+                $arrays[] = $this->twitter_user_array($profile, $includeStatuses);
             }
             print json_encode($arrays);
             break;
index 4115d9dcb48d7e908d2a679887c602b908476fac..4737c5874f7babc28d6d65db87c396859d64826f 100644 (file)
@@ -844,9 +844,9 @@ class TwitterapiAction extends Action
         $this->endXML();
     }
 
-    function show_profile($profile, $content_type='xml', $notice=null)
+    function show_profile($profile, $content_type='xml', $notice=null, $includeStatuses=true)
     {
-        $profile_array = $this->twitter_user_array($profile, true);
+        $profile_array = $this->twitter_user_array($profile, $includeStatuses);
         switch ($content_type) {
         case 'xml':
             $this->show_twitter_xml_user($profile_array);