Mercurial > pidgin
diff libpurple/xmlnode.c @ 29006:e1c01f236674
Correctly parse "<br>" in an XML attribute. Closes #11318.
If nobody has objections, I intend to add purple_unescape_text() to
util.[ch] for 2.7.0.
| author | Paul Aurich <paul@darkrain42.org> |
|---|---|
| date | Wed, 10 Feb 2010 03:32:29 +0000 |
| parents | 981374c7308b |
| children | 05d727f76ca9 |
line wrap: on
line diff
--- a/libpurple/xmlnode.c Tue Feb 09 06:56:00 2010 +0000 +++ b/libpurple/xmlnode.c Wed Feb 10 03:32:29 2010 +0000 @@ -545,6 +545,31 @@ return xml_with_declaration; } +static char *purple_unescape_text(const char *in) +{ + GString *ret; + const char *c = in; + + if (in == NULL) + return NULL; + + ret = g_string_new(""); + while (*c) { + int len; + const char *ent; + + if ((ent = purple_markup_unescape_entity(c, &len)) != NULL) { + g_string_append(ret, ent); + c += len; + } else { + g_string_append_c(ret, *c); + c++; + } + } + + return g_string_free(ret, FALSE); +} + struct _xmlnode_parser_data { xmlnode *current; gboolean error; @@ -590,7 +615,7 @@ int attrib_len = attributes[i+4] - attributes[i+3]; char *attrib = g_strndup((const char *)attributes[i+3], attrib_len); txt = attrib; - attrib = purple_unescape_html(txt); + attrib = purple_unescape_text(txt); g_free(txt); xmlnode_set_attrib_full(node, name, NULL, prefix, attrib); g_free(attrib);
