*/
function onRouterInitialized($m)
{
- $m->connect('admin/twitter', array('action' => 'twitteradminpanel'));
+ $m->connect('panel/twitter', array('action' => 'twitteradminpanel'));
if (self::hasKeys()) {
$m->connect(
/*
* Add a login tab for 'Sign in with Twitter'
*
- * @param Action &action the current action
+ * @param Action $action the current action
*
* @return void
*/
- function onEndLoginGroupNav(&$action)
+ function onEndLoginGroupNav($action)
{
$action_name = $action->trimmed('action');
/**
* Add the Twitter Settings page to the Connect Settings menu
*
- * @param Action &$action The calling page
+ * @param Action $action The calling page
*
* @return boolean hook return
*/
- function onEndConnectSettingsNav(&$action)
+ function onEndConnectSettingsNav($action)
{
if (self::hasKeys()) {
$action_name = $action->trimmed('action');
*/
function onStartEnqueueNotice($notice, &$transports)
{
- if (self::hasKeys() && $notice->isLocal()) {
+ if (self::hasKeys() && $notice->isLocal() && $notice->inScope(null)) {
// Avoid a possible loop
if ($notice->source != 'twitter') {
array_push($transports, 'twitter');
// Incoming statuses <- twitter
$manager->connect('tweetin', 'TweetInQueueHandler');
-
- // Control messages from our web interface to the import daemon
- $manager->connect('tweetctl', 'TweetCtlQueueHandler', 'twitter');
}
return true;
}
return true;
}
- $token = TwitterOAuthClient::unpackToken($flink->credentials);
- $client = new TwitterOAuthClient($token->key, $token->secret);
+ try {
+ $token = TwitterOAuthClient::unpackToken($flink->credentials);
+ $client = new TwitterOAuthClient($token->key, $token->secret);
- $client->statusesDestroy($n2s->status_id);
+ $client->statusesDestroy($n2s->status_id);
+ } catch (Exception $e) {
+ common_log(LOG_ERR, "Error attempting to delete bridged notice from Twitter: " . $e->getMessage());
+ }
$n2s->delete();
}
return true;
}
- $token = TwitterOAuthClient::unpackToken($flink->credentials);
- $client = new TwitterOAuthClient($token->key, $token->secret);
+ try {
+ $token = TwitterOAuthClient::unpackToken($flink->credentials);
+ $client = new TwitterOAuthClient($token->key, $token->secret);
- $client->favoritesCreate($status_id);
+ $client->favoritesCreate($status_id);
+ } catch (Exception $e) {
+ common_log(LOG_ERR, "Error attempting to favorite bridged notice on Twitter: " . $e->getMessage());
+ }
return true;
}
return true;
}
- $token = TwitterOAuthClient::unpackToken($flink->credentials);
- $client = new TwitterOAuthClient($token->key, $token->secret);
+ 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());
+ }
- $client->favoritesDestroy($status_id);
+ return true;
+ }
+ function onStartGetProfileUri($profile, &$uri)
+ {
+ if (preg_match('!^https?://twitter.com/!', $profile->profileurl)) {
+ $uri = $profile->profileurl;
+ return false;
+ }
return true;
}
}