changeset 22682:8f4f88e03efb

merge of '946d948a1aa4270fa46dabca767e9d727d4519eb' and '949fb9967a8d4bcae83af4ebc6b2681f26b17f5a'
author Mark Doliner <mark@kingant.net>
date Thu, 17 Apr 2008 07:09:46 +0000
parents a7ef2c82d125 (current diff) dfb1cf26e0c8 (diff)
children 0723826f9229 a184ac4eace6
files
diffstat 1 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/bonjour/jabber.c	Thu Apr 17 00:39:01 2008 +0000
+++ b/libpurple/protocols/bonjour/jabber.c	Thu Apr 17 07:09:46 2008 +0000
@@ -114,6 +114,28 @@
 	return "1";
 }
 
+static gchar *
+get_xmlnode_contents(xmlnode *node)
+{
+	gchar *contents;
+
+	contents = xmlnode_to_str(node, NULL);
+
+	/* we just want the stuff inside <font></font>
+	 * There isn't stuff exposed in xmlnode.c to do this more cleanly. */
+
+	if (contents) {
+		char *bodystart = strchr(contents, '>');
+		char *bodyend = strrchr(bodystart, '<');
+		if (bodystart && bodyend && (bodystart + 1) != bodyend) {
+			*bodyend = '\0';
+			memmove(contents, bodystart + 1, (bodyend - bodystart));
+		}
+	}
+
+	return contents;
+}
+
 static void
 _jabber_parse_and_write_message_to_ui(xmlnode *message_node, PurpleBuddy *pb)
 {
@@ -167,7 +189,7 @@
 				if (font_size != NULL)
 					font_size = _font_size_ichat_to_purple(atoi(font_size));
 				font_color = xmlnode_get_attrib(html_body_font_node, "color");
-				html_body = xmlnode_get_data(html_body_font_node);
+				html_body = get_xmlnode_contents(html_body_font_node);
 
 				if (html_body == NULL)
 					/* This is the kind of formated messages that Purple creates */