summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-09-05 00:42:58 -0400
committerEvan Prodromou <evan@status.net>2010-09-07 04:00:59 -0400
commita5554bc11e5565f30a42fa26cf94fe27a3477cd5 (patch)
tree6507c2c14a6fb32798658a5ec19d7a7c5eab35d3 /plugins
parent702d36257c6edb1e4f87087c60f1a534fc69a918 (diff)
check status_id before trying to retweet it
Diffstat (limited to 'plugins')
-rw-r--r--plugins/TwitterBridge/twitter.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php
index 94eaedee5..408463354 100644
--- a/plugins/TwitterBridge/twitter.php
+++ b/plugins/TwitterBridge/twitter.php
@@ -143,7 +143,10 @@ function broadcast_twitter($notice)
if (!empty($flink) && TwitterOAuthClient::isPackedToken($flink->credentials)) {
if (!empty($notice->repeat_of) && is_twitter_notice($notice->repeat_of)) {
- return retweet_notice($flink, Notice::staticGet('id', $notice->repeat_of));
+ $retweet = retweet_notice($flink, Notice::staticGet('id', $notice->repeat_of));
+ if (!empty($retweet)) {
+ Notice_to_status::saveNew($notice->id, $retweet->id);
+ }
} else if (is_twitter_bound($notice, $flink)) {
return broadcast_oauth($notice, $flink);
}
@@ -159,11 +162,14 @@ function retweet_notice($flink, $notice)
$id = twitter_status_id($notice);
+ if (empty($id)) {
+ common_log(LOG_WARNING, "Trying to retweet notice {$notice->id} with no known status id.");
+ return null;
+ }
+
try {
$status = $client->statusesRetweet($id);
- if (!empty($status)) {
- Notice_to_status::saveNew($notice->id, $status->id);
- }
+ return $status;
} catch (OAuthClientException $e) {
return process_error($e, $flink, $notice);
}