function broadcast_oauth($notice, $flink) { $user = $flink->getUser(); $statustxt = format_status($notice); $params = twitter_update_params($notice); $token = TwitterOAuthClient::unpackToken($flink->credentials); $client = new TwitterOAuthClient($token->key, $token->secret); $status = null; try { $status = $client->statusesUpdate($statustxt, $params); } catch (OAuthClientException $e) { return process_error($e, $flink, $notice); } if (empty($status)) { // This could represent a failure posting, // or the Twitter API might just be behaving flakey. $errmsg = sprintf('Twitter bridge - No data returned by Twitter API when ' . 'trying to post notice %d for User %s (user id %d).', $notice->id, $user->nickname, $user->id); common_log(LOG_WARNING, $errmsg); return false; } // Notice crossed the great divide $msg = sprintf('Twitter bridge - posted notice %d to Twitter using ' . 'OAuth for User %s (user id %d).', $notice->id, $user->nickname, $user->id); common_log(LOG_INFO, $msg); return true; }