pidgin: 0bb02399: After parsing the message text for HTML ...

qulogic at pidgin.im qulogic at pidgin.im
Wed Feb 4 00:20:33 EST 2009


-----------------------------------------------------------------
Revision: 0bb02399ead9501a3e7951cfba2e8e8350fe917c
Ancestor: 09b21e72b667110cc0a4bc0d2caafcc52e57175f
Author: qulogic at pidgin.im
Date: 2009-02-04T05:15:49
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/0bb02399ead9501a3e7951cfba2e8e8350fe917c

Modified files:
        libpurple/protocols/msn/msn.c

ChangeLog: 

After parsing the message text for HTML formatting, don't try to send it if
it ends up empty. That might happen if your message only contained stuff
like horizontal lines, which MSN does not support, and will ignore.

Fixes #8057.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/msn.c	ad1e13702df8b2b8bc69a290feca829603a7b7c4
+++ libpurple/protocols/msn/msn.c	f847fe0be0f75c39e9cc4ebfdce82a15332329ca
@@ -1176,6 +1176,7 @@ msn_send_im(PurpleConnection *gc, const 
 	MsnMessage *msg;
 	char *msgformat;
 	char *msgtext;
+	size_t msglen;
 	const char *username;
 
 	purple_debug_info("msn", "send IM {%s} to %s\n", message, who);
@@ -1203,13 +1204,23 @@ msn_send_im(PurpleConnection *gc, const 
 	}
 
 	msn_import_html(message, &msgformat, &msgtext);
+	msglen = strlen(msgtext);
+	if (msglen == 0) {
+		/* Stuff like <hr> will be ignored. Don't send an empty message
+		   if that's all there is. */
+		g_free(msgtext);
+		g_free(msgformat);
+
+		return 0;
+	}
+
 	if (msn_user_is_online(account, who) ||
 		msn_user_is_yahoo(account, who) ||
 		swboard != NULL) {
 		/*User online or have a swboard open because it's invisible
 		 * and sent us a message,then send Online Instant Message*/
  
-		if (strlen(msgtext) + strlen(msgformat) + strlen(VERSION) > 1564)
+		if (msglen + strlen(msgformat) + strlen(VERSION) > 1564)
 		{
 			g_free(msgformat);
 			g_free(msgtext);


More information about the Commits mailing list