+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;
+}
+
+/**
+ * Pull any extra information from a notice that we should transfer over
+ * to Twitter beyond the notice text itself.
+ *
+ * @param Notice $notice
+ * @return array of key-value pairs for Twitter update submission
+ * @access private
+ */
+function twitter_update_params($notice)
+{
+ $params = array();
+ if ($notice->lat || $notice->lon) {
+ $params['lat'] = $notice->lat;
+ $params['long'] = $notice->lon;
+ }
+ return $params;
+}
+