+function retweet_notice($flink, $notice)
+{
+ $token = TwitterOAuthClient::unpackToken($flink->credentials);
+ $client = new TwitterOAuthClient($token->key, $token->secret);
+
+ $id = twitter_status_id($notice);
+
+ try {
+ $status = $client->statusesRetweet($id);
+ } catch (OAuthClientException $e) {
+ return process_error($e, $flink, $notice);
+ }
+}
+
+function twitter_status_id($notice)
+{
+ if ($notice->source == 'twitter' &&
+ preg_match('#^http://twitter.com/[\w_.]+/status/(\d+)$#', $notice->uri, $match)) {
+ return $match[1];
+ }
+
+ return null;
+}
+