Mercurial > pidgin
changeset 22680:dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
broken for a long time. Fixes #5518.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Thu, 17 Apr 2008 02:45:37 +0000 |
parents | 84dc71e67a72 |
children | 8f4f88e03efb |
files | libpurple/protocols/bonjour/jabber.c |
diffstat | 1 files changed, 23 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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 <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 */