# HG changeset patch
# User Ethan Blanton <elb@pidgin.im>
# Date 1208029206 0
# Node ID bc9845b6f9c09d4dd3bcf38c7f6ce54c8cf7b5ce
# Parent  487105d73907fe4c08ce4c94c170d8b6b7d393eb
Strip mIRC formatting codes from PART and QUIT messages.

References #5495

diff -r 487105d73907 -r bc9845b6f9c0 ChangeLog
--- a/ChangeLog	Sat Apr 12 17:35:19 2008 +0000
+++ b/ChangeLog	Sat Apr 12 19:40:06 2008 +0000
@@ -3,7 +3,8 @@
 version 2.x.x:
 	libpurple:
 	* In MySpaceIM, messages from spambots are discarded (Justin Williams)
-
+	* Strip mIRC formatting codes from quit and part messages.
+	
 	Pidgin:
 	* The typing notification in the conversation history can be disabled or
 	  customized (font, color etc.) in .gtkrc-2.0.
diff -r 487105d73907 -r bc9845b6f9c0 libpurple/protocols/irc/msgs.c
--- a/libpurple/protocols/irc/msgs.c	Sat Apr 12 17:35:19 2008 +0000
+++ b/libpurple/protocols/irc/msgs.c	Sat Apr 12 19:40:06 2008 +0000
@@ -61,9 +61,11 @@
 
 static void irc_chat_remove_buddy(PurpleConversation *convo, char *data[2])
 {
-	char *message;
+	char *message, *stripped;
 
-	message = g_strdup_printf("quit: %s", data[1]);
+	stripped = data[1] ? irc_mirc2txt(data[1]) : NULL;
+	message = g_strdup_printf("quit: %s", stripped);
+	g_free(stripped);
 
 	if (purple_conv_chat_find_user(PURPLE_CONV_CHAT(convo), data[0]))
 		purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), data[0], message);
@@ -991,7 +993,9 @@
 		g_free(msg);
 		serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)));
 	} else {
-		purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), nick, args[1]);
+		msg = args[1] ? irc_mirc2txt(args[1]) : NULL;
+		purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), nick, msg);
+		g_free(msg);
 	}
 	g_free(nick);
 }