jabber: Fix the last commit to pass escaped text off to the core.

Sat, 31 Jul 2010 20:58:10 +0000

author
Paul Aurich <darkrain42@pidgin.im>
date
Sat, 31 Jul 2010 20:58:10 +0000
changeset 30583
2482f350d8f5
parent 30582
8a0729bb2624
child 30586
78d7bdf12f92

jabber: Fix the last commit to pass escaped text off to the core.
This probably fixes display of messages with <, >, &, etc in Pidgin.

Why does xmlnode_get_data_unescaped() exist if
xmlnode_get_data(<body>&amp;</body>) returns "&". I couldn't find a
single entity that wasn't unescaped. Then again, we can't really
change the functioning of those two functions without breaking
the world.

libpurple/protocols/jabber/message.c file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/jabber/message.c	Sat Jul 31 20:39:55 2010 +0000
+++ b/libpurple/protocols/jabber/message.c	Sat Jul 31 20:58:10 2010 +0000
@@ -246,8 +246,6 @@
 		}
 	}
 
-	purple_debug_warning("jabber CHAT", "MUC message: '%s', '%s'\n",
-	                     jm->xhtml, jm->body);
 	if(jm->xhtml || jm->body) {
 		if(jid->resource)
 			serv_got_chat_in(jm->js->gc, chat->id, jid->resource,
@@ -590,7 +588,9 @@
 		} else if(!strcmp(child->name, "body") && !strcmp(xmlns, NS_XMPP_CLIENT)) {
 			if(!jm->body) {
 				char *msg = xmlnode_get_data(child);
-				jm->body = purple_strdup_withhtml(msg);
+				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)) {

mercurial