function fetchTwitterFriends($flink)
 {
     $friends = array();
     $client = null;
     if (TwitterOAuthClient::isPackedToken($flink->credentials)) {
         $token = TwitterOAuthClient::unpackToken($flink->credentials);
         $client = new TwitterOAuthClient($token->key, $token->secret);
         common_debug($this->name() . '- Grabbing friends IDs with OAuth.');
     } else {
         common_debug("Skipping Twitter friends for {$flink->user_id} since not OAuth.");
         return $friends;
     }
     try {
         $friends_ids = $client->friendsIds();
     } catch (Exception $e) {
         common_log(LOG_WARNING, $this->name() . ' - error getting friend ids: ' . $e->getMessage());
         return $friends;
     }
     if (empty($friends_ids)) {
         common_debug($this->name() . " - Twitter user {$flink->foreign_id} " . 'doesn\'t have any friends!');
         return $friends;
     }
     common_debug($this->name() . ' - Twitter\'s API says Twitter user id ' . "{$flink->foreign_id} has " . count($friends_ids) . ' friends.');
     // Calculate how many pages to get...
     $pages = ceil(count($friends_ids) / 100);
     if ($pages == 0) {
         common_debug($this->name() . " - {$user} seems to have no friends.");
     }
     for ($i = 1; $i <= $pages; $i++) {
         try {
             $more_friends = $client->statusesFriends(null, null, null, $i);
         } catch (Exception $e) {
             common_log(LOG_WARNING, $this->name() . ' - cURL error getting Twitter statuses/friends ' . "page {$i} - " . $e->getCode() . ' - ' . $e->getMessage());
         }
         if (empty($more_friends)) {
             common_log(LOG_WARNING, $this->name() . " - Couldn't retrieve page {$i} " . "of Twitter user {$flink->foreign_id} friends.");
             continue;
         } else {
             if (is_array($more_friends)) {
                 $friends = array_merge($friends, $more_friends);
             }
         }
     }
     return $friends;
 }