summaryrefslogtreecommitdiff
path: root/scripts/synctwitterfriends.php
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2009-09-02 16:42:15 -0400
committerCraig Andrews <candrews@integralblue.com>2009-09-02 16:42:15 -0400
commita535ccdc4eba320ad88dc531329ae63c7f09c258 (patch)
treea8448dfe0b764818562ca9d04a39f04d4978dead /scripts/synctwitterfriends.php
parentf949c2c9d9afa63496f26b33d0309f8d06f77520 (diff)
parent0c95734a6874608ea5ed44608cabeda7c3a1b4ea (diff)
Merge remote branch 'laconica/0.8.x' into 0.9.x
Conflicts: lib/common.php lib/twitter.php
Diffstat (limited to 'scripts/synctwitterfriends.php')
-rwxr-xr-xscripts/synctwitterfriends.php17
1 files changed, 12 insertions, 5 deletions
diff --git a/scripts/synctwitterfriends.php b/scripts/synctwitterfriends.php
index 545cb23b3..b30e700a1 100755
--- a/scripts/synctwitterfriends.php
+++ b/scripts/synctwitterfriends.php
@@ -142,13 +142,20 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon
{
$friends = array();
- $token = TwitterOAuthClient::unpackToken($flink->credentials);
-
- $client = new TwitterOAuthClient($token->key, $token->secret);
+ $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 {
+ $client = new TwitterBasicAuthClient($flink);
+ common_debug($this->name() . '- Grabbing friends IDs with basic auth.');
+ }
try {
$friends_ids = $client->friendsIds();
- } catch (OAuthCurlException $e) {
+ } catch (Exception $e) {
common_log(LOG_WARNING, $this->name() .
' - cURL error getting friend ids ' .
$e->getCode() . ' - ' . $e->getMessage());
@@ -177,7 +184,7 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon
try {
$more_friends = $client->statusesFriends(null, null, null, $i);
- } catch (OAuthCurlException $e) {
+ } catch (Exception $e) {
common_log(LOG_WARNING, $this->name() .
' - cURL error getting Twitter statuses/friends ' .
"page $i - " . $e->getCode() . ' - ' .