diff options
Diffstat (limited to 'plugins/TwitterBridge')
-rw-r--r-- | plugins/TwitterBridge/twitter.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php index de30d9ebf..5761074c2 100644 --- a/plugins/TwitterBridge/twitter.php +++ b/plugins/TwitterBridge/twitter.php @@ -1,7 +1,7 @@ <?php /* * StatusNet - the distributed open-source microblogging tool - * Copyright (C) 2008, 2009, StatusNet, Inc. + * Copyright (C) 2008-2010 StatusNet, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -257,8 +257,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; } |