]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/TwitterBridge/daemons/synctwitterfriends.php
remove basic auth code for Twitter since it's no longer supported
[quix0rs-gnu-social.git] / plugins / TwitterBridge / daemons / synctwitterfriends.php
index 0668c6222f386affa86d7da722aad0aba0af0458..5641142d35bc882c4395851053fcead8643e4665 100755 (executable)
@@ -33,6 +33,8 @@ END_OF_TRIM_HELP;
 require_once INSTALLDIR . '/scripts/commandline.inc';
 require_once INSTALLDIR . '/lib/parallelizingdaemon.php';
 require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php';
+require_once INSTALLDIR . '/plugins/TwitterBridge/twitterbasicauthclient.php';
+require_once INSTALLDIR . '/plugins/TwitterBridge/twitteroauthclient.php';
 
 /**
  * Daemon to sync local friends with Twitter friends
@@ -45,14 +47,6 @@ require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php';
  * @link     http://status.net/
  */
 
-$helptext = <<<END_OF_TWITTER_HELP
-Batch script for synching local friends with Twitter friends.
-
-END_OF_TWITTER_HELP;
-
-require_once INSTALLDIR . '/scripts/commandline.inc';
-require_once INSTALLDIR . '/lib/parallelizingdaemon.php';
-
 class SyncTwitterFriendsDaemon extends ParallelizingDaemon
 {
     /**
@@ -150,16 +144,16 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon
             $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.');
+            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() .
-                       ' - cURL error getting friend ids ' .
-                       $e->getCode() . ' - ' . $e->getMessage());
+                       ' - error getting friend ids: ' .
+                       $e->getMessage());
             return $friends;
         }
 
@@ -227,7 +221,7 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon
             // Twitter friend
 
             if (!save_twitter_user($friend_id, $friend_name)) {
-                common_log(LOG_WARNING, $this-name() .
+                common_log(LOG_WARNING, $this->name() .
                            " - Couldn't save $screen_name's friend, $friend_name.");
                 continue;
             }