summaryrefslogtreecommitdiff
path: root/plugins/TwitterBridge/twitter.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-04-14 15:58:42 +0200
committerBrion Vibber <brion@pobox.com>2010-04-14 15:58:42 +0200
commitc95bff77446f7ce3454ef62b0c22e298de1d3e69 (patch)
tree817507654fd75c12efe5926812f61375a50a1338 /plugins/TwitterBridge/twitter.php
parent3da50c19dfff7645dc46f1b836ebf4ecda726129 (diff)
parentefcdfabc1225a2fdcb37a6cc3c96982b24b88d8f (diff)
Merge branch 'master' into testing
Diffstat (limited to 'plugins/TwitterBridge/twitter.php')
-rw-r--r--plugins/TwitterBridge/twitter.php26
1 files changed, 24 insertions, 2 deletions
diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php
index 2805b3ab5..21adc7a90 100644
--- a/plugins/TwitterBridge/twitter.php
+++ b/plugins/TwitterBridge/twitter.php
@@ -124,15 +124,36 @@ function broadcast_twitter($notice)
return true;
}
+/**
+ * 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;
+}
+
+
function broadcast_oauth($notice, $flink) {
$user = $flink->getUser();
$statustxt = format_status($notice);
+ $params = twitter_update_params($notice);
+
$token = TwitterOAuthClient::unpackToken($flink->credentials);
$client = new TwitterOAuthClient($token->key, $token->secret);
$status = null;
try {
- $status = $client->statusesUpdate($statustxt);
+ $status = $client->statusesUpdate($statustxt, $params);
} catch (OAuthClientException $e) {
return process_error($e, $flink, $notice);
}
@@ -171,12 +192,13 @@ function broadcast_basicauth($notice, $flink)
$user = $flink->getUser();
$statustxt = format_status($notice);
+ $params = twitter_update_params($notice);
$client = new TwitterBasicAuthClient($flink);
$status = null;
try {
- $status = $client->statusesUpdate($statustxt);
+ $status = $client->statusesUpdate($statustxt, $params);
} catch (BasicAuthException $e) {
return process_error($e, $flink, $notice);
}