Mercurial > pidgin.yaz
changeset 24347:f18f37a62971
merge of '54ee2acb5f6ef92c29503315eb7c24bae221cd7b'
and '6f0bf9d5a17857431bb0efc78f6d591e25772ddd'
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 13 Nov 2008 09:00:45 +0000 |
parents | 9e0458c98b4c (diff) 89cb1c13036e (current diff) |
children | 965699159512 e71c1fad229f 2f01775c81d5 7183d12b96ed d855ff9cf839 365b90fa23cf |
files | |
diffstat | 4 files changed, 35 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/COPYRIGHT Thu Nov 13 08:58:44 2008 +0000 +++ b/COPYRIGHT Thu Nov 13 09:00:45 2008 +0000 @@ -145,6 +145,7 @@ Evgueni V. Gavrilov Ignacy Gawedzki Georgi Georgiev +Brian Geppert Thomas Gibson-Robinson Ike Gingerich Gustavo Giráldez
--- a/ChangeLog Thu Nov 13 08:58:44 2008 +0000 +++ b/ChangeLog Thu Nov 13 09:00:45 2008 +0000 @@ -7,6 +7,7 @@ "Microsoft Internet Authority" certificates. People that use --with-system-ssl-certs and GnuTLS need to include these in the system certs directory. + * Corrected maximum message lengths for Yahoo! Pidgin: * On GTK+ 2.14 and higher, we're using the gtk-tooltip-delay setting
--- a/libpurple/protocols/yahoo/yahoo.c Thu Nov 13 08:58:44 2008 +0000 +++ b/libpurple/protocols/yahoo/yahoo.c Thu Nov 13 09:00:45 2008 +0000 @@ -3619,8 +3619,26 @@ PurpleWhiteboard *wb; int ret = 1; YahooFriend *f = NULL; + gsize lenb = 0; + glong lenc = 0; msg2 = yahoo_string_encode(gc, msg, &utf8); + + if(msg2) { + lenb = strlen(msg2); + lenc = g_utf8_strlen(msg2, -1); + + if(lenb > YAHOO_MAX_MESSAGE_LENGTH_BYTES || lenc > YAHOO_MAX_MESSAGE_LENGTH_CHARS) { + purple_debug_info("yahoo", "Message too big. Length is %" G_GSIZE_FORMAT + " bytes, %ld characters. Max is %d bytes, %d chars." + " Message is '%s'.\n", lenb, lenc, YAHOO_MAX_MESSAGE_LENGTH_BYTES, + YAHOO_MAX_MESSAGE_LENGTH_CHARS, msg2); + yahoo_packet_free(pkt); + g_free(msg); + g_free(msg2); + return -E2BIG; + } + } yahoo_packet_hash(pkt, "ss", 1, purple_connection_get_display_name(gc), 5, who); if ((f = yahoo_friend_find(gc, who)) && f->protocol)
--- a/libpurple/protocols/yahoo/yahoo.h Thu Nov 13 08:58:44 2008 +0000 +++ b/libpurple/protocols/yahoo/yahoo.h Thu Nov 13 09:00:45 2008 +0000 @@ -182,6 +182,21 @@ #define YAHOO_MAX_STATUS_MESSAGE_LENGTH (255) +/* + * Current Maximum Length for Instant Messages + * + * This was found by experiment. + * + * The YMSG protocol allows a message of up to 948 bytes, but the official client + * limits to 800 characters. According to experiments I conducted, it seems that + * the discrepancy is to allow some leeway for messages with mixed single- and + * multi-byte characters, as I was able to send messages of 840 and 932 bytes + * by using some multibyte characters (some random Chinese or Japanese characters, + * to be precise). - rekkanoryo + */ +#define YAHOO_MAX_MESSAGE_LENGTH_BYTES 948 +#define YAHOO_MAX_MESSAGE_LENGTH_CHARS 800 + /* sometimes i wish prpls could #include things from other prpls. then i could just * use the routines from libfaim and not have to admit to knowing how they work. */ #define yahoo_put16(buf, data) ( \