# HG changeset patch # User Daniel Atallah # Date 1208400337 0 # Node ID dfb1cf26e0c876829ebb17fe1e01fa04b9a86a2f # Parent 84dc71e67a7241990e90e9d432b04acbd3f5c0c3 Fix an issue with formatting in Bonjour messages. It looks like it has been broken for a long time. Fixes #5518. diff -r 84dc71e67a72 -r dfb1cf26e0c8 libpurple/protocols/bonjour/jabber.c --- a/libpurple/protocols/bonjour/jabber.c Wed Apr 16 21:34:38 2008 +0000 +++ b/libpurple/protocols/bonjour/jabber.c Thu Apr 17 02:45:37 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 + * 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 */