From 4c812bf8a983f18da99b558d7159ccb58e27422e Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 30 Aug 2009 18:35:44 -0300 Subject: [PATCH] Convert !group tags to #hash tags when bridging outgoing notices to Twitter http://status.net/trac/ticket/1672 --- lib/twitter.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/twitter.php b/lib/twitter.php index 7546ffa98a..4fff58fd20 100644 --- a/lib/twitter.php +++ b/lib/twitter.php @@ -160,6 +160,9 @@ function broadcast_twitter($notice) // XXX: Hack to get around PHP cURL's use of @ being a a meta character $statustxt = preg_replace('/^@/', ' @', $notice->content); + // Convert !groups to #hashes + $statustxt = preg_replace('/(^|\s)!([A-Za-z0-9]{1,64})/', "\\1#\\2", $statustxt); + $token = TwitterOAuthClient::unpackToken($flink->credentials); $client = new TwitterOAuthClient($token->key, $token->secret);