Mercurial > pidgin
comparison libpurple/protocols/yahoo/yahoo.c @ 24400:9e0458c98b4c
This was originally a patch from Brian Geppert that corrected the 'silently
truncates messages at 800 characters' bug in yahoo. I changed the patch to
reflect the reality I saw, which is that the maximum message length is 946
bytes, but only 800 characters. It's possible to fall between 800 and 946
bytes but not exceed 800 characters by using multibyte characters.
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Thu, 13 Nov 2008 08:39:44 +0000 |
parents | b5210bb72273 |
children | c457c635eb8f adf153852bcf 94fa7211eb98 d855ff9cf839 |
comparison
equal
deleted
inserted
replaced
24399:9bdaf273c0ff | 24400:9e0458c98b4c |
---|---|
3617 char *msg2; | 3617 char *msg2; |
3618 gboolean utf8 = TRUE; | 3618 gboolean utf8 = TRUE; |
3619 PurpleWhiteboard *wb; | 3619 PurpleWhiteboard *wb; |
3620 int ret = 1; | 3620 int ret = 1; |
3621 YahooFriend *f = NULL; | 3621 YahooFriend *f = NULL; |
3622 gsize lenb = 0; | |
3623 glong lenc = 0; | |
3622 | 3624 |
3623 msg2 = yahoo_string_encode(gc, msg, &utf8); | 3625 msg2 = yahoo_string_encode(gc, msg, &utf8); |
3626 | |
3627 if(msg2) { | |
3628 lenb = strlen(msg2); | |
3629 lenc = g_utf8_strlen(msg2, -1); | |
3630 | |
3631 if(lenb > YAHOO_MAX_MESSAGE_LENGTH_BYTES || lenc > YAHOO_MAX_MESSAGE_LENGTH_CHARS) { | |
3632 purple_debug_info("yahoo", "Message too big. Length is %" G_GSIZE_FORMAT | |
3633 " bytes, %ld characters. Max is %d bytes, %d chars." | |
3634 " Message is '%s'.\n", lenb, lenc, YAHOO_MAX_MESSAGE_LENGTH_BYTES, | |
3635 YAHOO_MAX_MESSAGE_LENGTH_CHARS, msg2); | |
3636 yahoo_packet_free(pkt); | |
3637 g_free(msg); | |
3638 g_free(msg2); | |
3639 return -E2BIG; | |
3640 } | |
3641 } | |
3624 | 3642 |
3625 yahoo_packet_hash(pkt, "ss", 1, purple_connection_get_display_name(gc), 5, who); | 3643 yahoo_packet_hash(pkt, "ss", 1, purple_connection_get_display_name(gc), 5, who); |
3626 if ((f = yahoo_friend_find(gc, who)) && f->protocol) | 3644 if ((f = yahoo_friend_find(gc, who)) && f->protocol) |
3627 yahoo_packet_hash_int(pkt, 241, f->protocol); | 3645 yahoo_packet_hash_int(pkt, 241, f->protocol); |
3628 | 3646 |