diff libpurple/protocols/msn/msn.c @ 25947:4b8c4870b13a

propagate from branch 'im.pidgin.pidgin.next.minor' (head 7305b29db7bd00d3261f348c71674c93aa31b327) to branch 'im.pidgin.pidgin' (head d8c03c68d591d9392607d954942ee58b8618d946)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 02 Mar 2009 04:18:40 +0000
parents 94a6eb10c691 fd5eedf131b4
children ff4212a5268f 9407348dc714
line wrap: on
line diff
--- a/libpurple/protocols/msn/msn.c	Wed Feb 25 20:03:08 2009 +0000
+++ b/libpurple/protocols/msn/msn.c	Mon Mar 02 04:18:40 2009 +0000
@@ -859,11 +859,11 @@
 	types = g_list_append(types, status);
 
 	status = purple_status_type_new_full(PURPLE_STATUS_INVISIBLE,
-			NULL, NULL, FALSE, TRUE, FALSE);
+			NULL, NULL, TRUE, TRUE, FALSE);
 	types = g_list_append(types, status);
 
 	status = purple_status_type_new_full(PURPLE_STATUS_OFFLINE,
-			NULL, NULL, FALSE, TRUE, FALSE);
+			NULL, NULL, TRUE, TRUE, FALSE);
 	types = g_list_append(types, status);
 
 	status = purple_status_type_new_full(PURPLE_STATUS_MOBILE,
@@ -1182,6 +1182,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);
@@ -1209,13 +1210,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);
@@ -1462,9 +1473,18 @@
 		   what to do with users already in the list and stuff... */
 		msn_userlist_add_buddy(userlist, who, gname);
 	} else {
+		char **tokens;
+		char *fqy;
 		/* We need to check the network for this buddy first */
 		msn_userlist_save_pending_buddy(userlist, who, gname);
-		msn_notification_send_fqy(session, who);
+		tokens = g_strsplit(who, "@", 2);
+		fqy = g_strdup_printf("<ml><d n=\"%s\"><c n=\"%s\"/></d></ml>",
+		                      tokens[1],
+		                      tokens[0]);
+		msn_notification_send_fqy(session, fqy, strlen(fqy),
+		                          (MsnFqyCb)msn_userlist_add_pending_buddy);
+		g_free(fqy);
+		g_strfreev(tokens);
 	}
 }