We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit e292d8fb authored by Brion Vibber's avatar Brion Vibber

Fix for 140-char replies being unexpectedly cropped when bridged to Twitter.

This drops the '@' -> ' @' hack for CURL meta-chars in outgoing Twitter bridge, added in commit 04b95c25 back in the day.
The Twitter bridge has since been switched from using direct CURL calls to using HTTPClient, which even with the CURL backend enabled doesn't trigger this issue, as POST parameters are formatted directly.
Prepending the space before we did the message cropping was leading to 140-char messages getting cropped unnecessarily, which was confusing:

Examples of broken messages:
http://identi.ca/notice/57172587 vs http://twitter.com/marjoleink/status/28398050691
http://identi.ca/notice/57172878 vs http://twitter.com/marjoleink/status/28398492563
parent 6841a8d0
...@@ -282,15 +282,14 @@ function process_error($e, $flink, $notice) ...@@ -282,15 +282,14 @@ function process_error($e, $flink, $notice)
function format_status($notice) function format_status($notice)
{ {
// XXX: Hack to get around PHP cURL's use of @ being a a meta character // Start with the plaintext source of this notice...
$statustxt = preg_replace('/^@/', ' @', $notice->content); $statustxt = $notice->content;
// Convert !groups to #hashes // Convert !groups to #hashes
// XXX: Make this an optional setting? // XXX: Make this an optional setting?
$statustxt = preg_replace('/(^|\s)!([A-Za-z0-9]{1,64})/', "\\1#\\2", $statustxt); $statustxt = preg_replace('/(^|\s)!([A-Za-z0-9]{1,64})/', "\\1#\\2", $statustxt);
// Twitter still has a 140-char hardcoded max.
if (mb_strlen($statustxt) > 140) { if (mb_strlen($statustxt) > 140) {
$noticeUrl = common_shorten_url($notice->uri); $noticeUrl = common_shorten_url($notice->uri);
$urlLen = mb_strlen($noticeUrl); $urlLen = mb_strlen($noticeUrl);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment