From: <bo...@us...> - 2006-12-17 12:59:07
|
Revision: 18015 http://svn.sourceforge.net/gaim/?rev=18015&view=rev Author: boler Date: 2006-12-17 04:59:04 -0800 (Sun, 17 Dec 2006) Log Message: ----------- gg: Don't send messages exceeding GG_MSG_MAXSIZE. (Fixes #1614894) Modified Paths: -------------- trunk/libgaim/protocols/gg/gg.c Modified: trunk/libgaim/protocols/gg/gg.c =================================================================== --- trunk/libgaim/protocols/gg/gg.c 2006-12-17 08:06:48 UTC (rev 18014) +++ trunk/libgaim/protocols/gg/gg.c 2006-12-17 12:59:04 UTC (rev 18015) @@ -1761,24 +1761,31 @@ { GGPInfo *info = gc->proto_data; char *tmp, *plain; + int ret = 0; - if (strlen(msg) == 0) - return 1; + if (strlen(msg) == 0) { + return 0; + } + gaim_debug_info("gg", "ggp_send_im: msg = %s\n", msg); plain = gaim_unescape_html(msg); - gaim_debug_info("gg", "ggp_send_im: msg = %s\n", msg); tmp = charset_convert(plain, "UTF-8", "CP1250"); - g_free(plain); - if (tmp != NULL && strlen(tmp) > 0) { - if (gg_send_message(info->session, GG_CLASS_CHAT, + if (NULL == tmp || strlen(tmp) == 0) { + ret = 0; + } else if (strlen(tmp) > GG_MSG_MAXSIZE) { + ret = -E2BIG; + } else if (gg_send_message(info->session, GG_CLASS_CHAT, ggp_str_to_uin(who), (unsigned char *)tmp) < 0) { - return -1; - } + ret = -1; + } else { + ret = 1; } + + g_free(plain); g_free(tmp); - return 1; + return ret; } /* }}} */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |