changeset 30321:00851eae12c7

merge of 'a7d49884941697519567616ac54f4c2884df05e2' and 'e15c002b6cf19a3cf1843b35457ff8b1efa78a5a'
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 31 Jul 2010 23:43:39 +0000
parents 66c175a474a6 (diff) e9fbbfe1ab70 (current diff)
children 2244a84407a4
files
diffstat 2 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/chat.c	Sat Jul 31 23:43:37 2010 +0000
+++ b/libpurple/protocols/jabber/chat.c	Sat Jul 31 23:43:39 2010 +0000
@@ -173,8 +173,10 @@
 		xmlnode_set_namespace(x, "http://jabber.org/protocol/muc#user");
 		invite = xmlnode_new_child(x, "invite");
 		xmlnode_set_attrib(invite, "to", name);
-		body = xmlnode_new_child(invite, "reason");
-		xmlnode_insert_data(body, msg, -1);
+		if (msg) {
+			body = xmlnode_new_child(invite, "reason");
+			xmlnode_insert_data(body, msg, -1);
+		}
 	} else {
 		xmlnode_set_attrib(message, "to", name);
 		/*
@@ -184,14 +186,17 @@
 		 *
 		 * Left here for compatibility.
 		 */
-		body = xmlnode_new_child(message, "body");
-		xmlnode_insert_data(body, msg, -1);
+		if (msg) {
+			body = xmlnode_new_child(message, "body");
+			xmlnode_insert_data(body, msg, -1);
+		}
 
 		x = xmlnode_new_child(message, "x");
 		xmlnode_set_attrib(x, "jid", room_jid);
 
 		/* The better place for it! XEP-0249 style. */
-		xmlnode_set_attrib(x, "reason", msg);
+		if (msg)
+			xmlnode_set_attrib(x, "reason", msg);
 		xmlnode_set_namespace(x, "jabber:x:conference");
 	}
 
--- a/libpurple/protocols/jabber/message.c	Sat Jul 31 23:43:37 2010 +0000
+++ b/libpurple/protocols/jabber/message.c	Sat Jul 31 23:43:39 2010 +0000
@@ -587,8 +587,10 @@
 				jm->thread_id = xmlnode_get_data(child);
 		} else if(!strcmp(child->name, "body") && !strcmp(xmlns, NS_XMPP_CLIENT)) {
 			if(!jm->body) {
-				char *msg = xmlnode_to_str(child, NULL);
-				jm->body = purple_strdup_withhtml(msg);
+				char *msg = xmlnode_get_data(child);
+				char *escaped = purple_markup_escape_text(msg, -1);
+				jm->body = purple_strdup_withhtml(escaped);
+				g_free(escaped);
 				g_free(msg);
 			}
 		} else if(!strcmp(child->name, "html") && !strcmp(xmlns, NS_XHTML_IM)) {