changeset 25418:b0c75121cf66

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.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Wed, 04 Feb 2009 05:15:49 +0000
parents b5699546f3e0
children 4278d13b5471 575b2b9f3ac9 af42303654a5
files libpurple/protocols/msn/msn.c
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/msn.c	Wed Feb 04 01:44:30 2009 +0000
+++ b/libpurple/protocols/msn/msn.c	Wed Feb 04 05:15:49 2009 +0000
@@ -1176,6 +1176,7 @@
 	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_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);