summaryrefslogtreecommitdiff
path: root/plugins/TwitterBridge/twitter.php
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/TwitterBridge/twitter.php')
-rw-r--r--plugins/TwitterBridge/twitter.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php
index 508699939..2805b3ab5 100644
--- a/plugins/TwitterBridge/twitter.php
+++ b/plugins/TwitterBridge/twitter.php
@@ -252,8 +252,17 @@ function format_status($notice)
$statustxt = preg_replace('/^@/', ' @', $notice->content);
// Convert !groups to #hashes
+
+ // XXX: Make this an optional setting?
+
$statustxt = preg_replace('/(^|\s)!([A-Za-z0-9]{1,64})/', "\\1#\\2", $statustxt);
+ if (mb_strlen($statustxt) > 140) {
+ $noticeUrl = common_shorten_url($notice->uri);
+ $urlLen = mb_strlen($noticeUrl);
+ $statustxt = mb_substr($statustxt, 0, 140 - ($urlLen + 3)) . ' … ' . $noticeUrl;
+ }
+
return $statustxt;
}