/** * Notify remote users when their notices get de-favorited. * * @param Profile $profile Profile person doing the de-faving * @param Notice $notice Notice being favored * * @return hook return value */ function onEndDisfavorNotice(Profile $profile, Notice $notice) { $flink = Foreign_link::getByUserID($profile->id, TWITTER_SERVICE); // twitter service if (empty($flink)) { return true; } if (!TwitterOAuthClient::isPackedToken($flink->credentials)) { $this->log(LOG_INFO, "Skipping fave processing for {$profile->id} since link is not OAuth."); return true; } $status_id = twitter_status_id($notice); if (empty($status_id)) { return true; } try { $token = TwitterOAuthClient::unpackToken($flink->credentials); $client = new TwitterOAuthClient($token->key, $token->secret); $client->favoritesDestroy($status_id); } catch (Exception $e) { common_log(LOG_ERR, "Error attempting to unfavorite bridged notice on Twitter: " . $e->getMessage()); } return true; }
/** * Notify remote users when their notices get de-favorited. * * @param Profile $profile Profile person doing the de-faving * @param Notice $notice Notice being favored * * @return hook return value */ function onEndDisfavorNotice(Profile $profile, Notice $notice) { $flink = Foreign_link::getByUserID($profile->id, TWITTER_SERVICE); // twitter service if (empty($flink)) { return true; } if (!TwitterOAuthClient::isPackedToken($flink->credentials)) { $this->log(LOG_INFO, "Skipping fave processing for {$profile->id} since link is not OAuth."); return true; } $status_id = twitter_status_id($notice); if (empty($status_id)) { return true; } $token = TwitterOAuthClient::unpackToken($flink->credentials); $client = new TwitterOAuthClient($token->key, $token->secret); $client->favoritesDestroy($status_id); return true; }