diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2013-07-13 19:49:13 +0100 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2013-07-13 19:49:13 +0100 | 
| commit | a685409f7e5587fa123b380775afd1586d938358 (patch) | |
| tree | daddaa2ed1f48f67a03becfdd3077178e8985ed9 | |
| parent | c92ee728d0d3741ce9094b076bf12a5a2e0e3c66 (diff) | |
Update to deal with a not-so-recent regression in the Twitter URL lenghtening
service. https://dev.twitter.com/blog/upcoming-tco-changes #1077
Seriously guys, stop being so obnoxious. This t.co garbage lengthens pretty
much everything (that looks like a) URL at this point. Stop counting it towards
the 140-char limit.
| -rw-r--r-- | protocols/twitter/twitter.c | 5 | 
1 files changed, 3 insertions, 2 deletions
| diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index 57820568..70e11067 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -237,6 +237,7 @@ int twitter_url_len_diff(gchar *msg, unsigned int target_len)  	while (g_match_info_matches(match_info)) {  		gchar *url = g_match_info_fetch(match_info, 2);  		url_len_diff += target_len - g_utf8_strlen(url, -1); +		/* Add another character for https://t.co/... URLs */  		if (g_match_info_fetch(match_info, 3) != NULL)  			url_len_diff += 1;  		g_free(url); @@ -252,7 +253,7 @@ static gboolean twitter_length_check(struct im_connection *ic, gchar * msg)  	int max = set_getint(&ic->acc->set, "message_length"), len;  	int target_len = set_getint(&ic->acc->set, "target_url_length");  	int url_len_diff = 0; -     +  	if (target_len > 0)  		url_len_diff = twitter_url_len_diff(msg, target_len); @@ -290,7 +291,7 @@ static void twitter_init(account_t * acc)  	if (strcmp(acc->prpl->name, "twitter") == 0) {  		def_url = TWITTER_API_URL; -		def_tul = "20"; +		def_tul = "22";  		def_mentions = "true";  	} else {		/* if( strcmp( acc->prpl->name, "identica" ) == 0 ) */  		def_url = IDENTICA_API_URL; | 
