Bug 285453 - Take Twitter's automatic shortening of URLs into consideration when counting tweet length
Summary: Take Twitter's automatic shortening of URLs into consideration when counting ...
Status: RESOLVED FIXED
Alias: None
Product: choqok
Classification: Applications
Component: Twitter (show other bugs)
Version: 1.0
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: 1.5
Assignee: Andrea Scarpino
URL:
Keywords:
: 294969 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-11-01 11:28 UTC by Michael Gorven
Modified: 2015-08-03 18:45 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 1.5


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Gorven 2011-11-01 11:28:52 UTC
Version:           1.0 (using KDE 4.6.5) 
OS:                Linux

Twitter automatically shortens all URLs longer than 18 characters with their t.co domain. URLs therefore count a maximum of 19 characters to the length of the Tweet. choqok should take this into consideration when calculating the length of the tweet when composing.

Reproducible: Always

Steps to Reproduce:
Compose the following tweet: "This is an example of a long tweet which is counted as too long because of Twitter's automatic shortening. https://dev.twitter.com/docs/tco-link-wrapper"

Actual Results:  
Remaining characters is displayed as -12.

Expected Results:  
Remaining characters should be 14.

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
Comment 1 Andrea Scarpino 2014-12-16 10:14:09 UTC
This also happens when attaching a media.
Write a tweet 140 chars long and attach a media. Choqok reports "0" chars remaining, but Twitter says -23 because the attached media becomes a link that is appended to the tweet.
Comment 2 Andrea Scarpino 2014-12-24 07:15:18 UTC
Git commit 9286fdb31cb31985420c934b04305fb03fbe4251 by Andrea Scarpino.
Committed on 20/12/2014 at 08:51.
Pushed by scarpino into branch 'master'.

Take Twitter's t.co urls lenght in consideration

See https://dev.twitter.com/overview/t.co for more info.

REVIEW: 121610
FIXED-IN: 1.5

M  +1    -1    helperlibs/twitterapihelper/twitterapicomposerwidget.cpp
M  +104  -5    helperlibs/twitterapihelper/twitterapitextedit.cpp
M  +10   -3    helperlibs/twitterapihelper/twitterapitextedit.h
M  +1    -0    libchoqok/CMakeLists.txt
M  +15   -0    libchoqok/ui/choqoktextedit.cpp
M  +4    -1    libchoqok/ui/choqoktextedit.h
M  +14   -54   libchoqok/ui/postwidget.cpp
M  +1    -2    libchoqok/ui/postwidget.h
A  +101  -0    libchoqok/urlutils.cpp     [License: GPL]
A  +47   -0    libchoqok/urlutils.h     [License: GPL]
M  +1    -1    microblogs/laconica/laconicacomposerwidget.cpp

http://commits.kde.org/choqok/9286fdb31cb31985420c934b04305fb03fbe4251
Comment 3 Andrea Scarpino 2015-08-03 18:45:57 UTC
*** Bug 294969 has been marked as a duplicate of this bug. ***