Modify

#855 closed defect (fixed)

[Twitter] count URLs as $short_url_length

Reported by: ilf <ilf@…> Owned by:
Priority: normal Milestone:
Component: Twitter Version: 3.0.3
Keywords: Cc:
IRC client+version: Client-independent Operating System: Public server
OS version/distro:

Description

Twitter is forcing their t.co URL Wrapper in everything now. Currently, Tweet length is counted as the amount of characters. Since Twitter will change URLs to t.co URLs, URLs shouldn't be counted in their original form, but by the value of "short_url_length" in help/configuration, which is currently 19.

https://dev.twitter.com/docs/tco-link-wrapper/faq#How_do_I_calculate_if_a_Tweet_with_a_link_is_going_to_be_over_140_characters_or_not

Example:

Posting this from Twitter: "This ChangeLog mostly lists changes relevant to users. A full log can be found in the bzr commit logs: http://bugs.bitlbee.org/bitlbee/browser/devel/doc/CHANGES" results in the error: "twitter - Error: Maximum message length exceeded: 160 > 140"

Since the URL will be shortened, the actual character count is 123.

Attachments (3)

bitlbee-bzr872-twitter_tco_url_length.patch (1.5 KB) - added by Artem Savkov <artem.savkov@…> at 2012-01-26T16:50:19Z.
bitlbee-bzr872-twitter_tco_url_length_set.patch (1.6 KB) - added by Artem Savkov <artem.savkov@…> at 2012-01-27T07:30:51Z.
bitlbee-bzr877-twitter_tco_url_length.patch (2.9 KB) - added by Artem Savkov <artem.savkov@…> at 2012-01-31T14:11:04Z.

Download all attachments as: .zip

Change History (11)

comment:1 Changed at 2011-11-14T11:17:06Z by wilmer

Component: BitlBeeTwitter

comment:2 Changed at 2012-01-04T15:37:12Z by anonymous

+1 for this feature. Would be very useful.

comment:3 Changed at 2012-01-26T08:50:49Z by MaienM

+1. This bug is quite annoying, preventing you from fully using the already quite limited 140 characters :(

Changed at 2012-01-26T16:50:19Z by Artem Savkov <artem.savkov@…>

comment:4 Changed at 2012-01-26T16:58:34Z by Artem Savkov <artem.savkov@…>

Turns out glib supports regexps, yay. Heres a patch for this issue. The only thing that concerns me here is that the regexp is recompiled for every message, but I couldn't find a good place to store it and it doesn't seem to affect performance much.

Changed at 2012-01-27T07:30:51Z by Artem Savkov <artem.savkov@…>

comment:5 Changed at 2012-01-27T07:32:50Z by Artem Savkov <artem.savkov@…>

Updated version. Replaced TCO_LEN define with target_url_length set variable (defaults to 20), setting it to 0 or negative disables the feature. If target url is https:// 1 is added to target_url_length.

Changed at 2012-01-31T14:11:04Z by Artem Savkov <artem.savkov@…>

comment:6 Changed at 2012-01-31T14:12:19Z by Artem Savkov <artem.savkov@…>

Same as previous, but the setting is disabled for identica accs by default. +documentation

comment:7 Changed at 2012-02-08T00:28:23Z by wilmer

Resolution: fixed
Status: newclosed

changeset:devel,878.

Thanks once again, Artem!

comment:8 Changed at 2012-05-06T15:47:39Z by robert@…

This patch breaks RHEL 5 support, see bug #955

Modify Ticket

Action
as closed The ticket will remain with no owner.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.