diff libpurple/protocols/jabber/message.c @ 27937:1337d2813b2d

propagate from branch 'im.pidgin.pidgin' (head 5ab68ddb0251205f7ef97f4c280e65696cbd5ff2) to branch 'im.pidgin.pidgin.yaz' (head 7a5d48783707dd377fd754961d3b009c3e492827)
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 07 Apr 2009 14:32:50 +0000
parents ae41d8e827e3 d8e6a2d592a4
children f3ccb5a36fd6
line wrap: on
line diff
--- a/libpurple/protocols/jabber/message.c	Tue Apr 07 05:28:58 2009 +0000
+++ b/libpurple/protocols/jabber/message.c	Tue Apr 07 14:32:50 2009 +0000
@@ -604,13 +604,17 @@
 				jm->thread_id = xmlnode_get_data(child);
 		} else if(!strcmp(child->name, "body") && !strcmp(xmlns,"jabber:client")) {
 			if(!jm->body) {
-				char *msg = xmlnode_to_str(child, NULL);
+				char *tmp, *msg;
+				gsize len;
+				tmp = xmlnode_to_str(child, NULL);
+				msg = sanitize_utf(tmp, strlen(tmp), &len);
 				jm->body = purple_strdup_withhtml(msg);
-				g_free(msg);
+				g_free(msg); g_free(tmp);
 			}
 		} else if(!strcmp(child->name, "html") && !strcmp(xmlns,"http://jabber.org/protocol/xhtml-im")) {
 			if(!jm->xhtml && xmlnode_get_child(child, "body")) {
 				char *c;
+				gsize len;
 
 				const PurpleConnection *gc = js->gc;
 				const gchar *who = xmlnode_get_attrib(packet, "from");
@@ -658,7 +662,9 @@
 				reformatted_xhtml =
 					jabber_message_xml_to_string_strip_img_smileys(child);
 
-				jm->xhtml = reformatted_xhtml;
+				jm->xhtml =
+					sanitize_utf(reformatted_xhtml,
+								 strlen(reformatted_xhtml), &len);
 
 				/* add known custom emoticons to the conversation */
 				/* note: if there were no smileys in the incoming message, or