Mercurial > pidgin.yaz
changeset 18073:8bad8a91d128
merge of '4211412db7d18ca946c93c5a6ba8931ff8244de0'
and 'f9fde664d495819679adeb390328646e1208ee22'
author | Richard Nelson <wabz@pidgin.im> |
---|---|
date | Fri, 08 Jun 2007 13:06:21 +0000 |
parents | 3fc94e7c7056 (diff) bb9cd8dfc61c (current diff) |
children | 7e309149360f c885a9ccd301 |
files | |
diffstat | 2 files changed, 28 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/xmlnode.c Fri Jun 08 12:43:57 2007 +0000 +++ b/libpurple/xmlnode.c Fri Jun 08 13:06:21 2007 +0000 @@ -333,8 +333,9 @@ for(c = node->child; c; c = c->next) { if(c->type == XMLNODE_TYPE_DATA) { if(!str) - str = g_string_new(""); - str = g_string_append_len(str, c->data, c->data_sz); + str = g_string_new_len(c->data, c->data_sz); + else + str = g_string_append_len(str, c->data, c->data_sz); } } @@ -344,6 +345,18 @@ return g_string_free(str, FALSE); } +char * +xmlnode_get_data_unescaped(xmlnode *node) +{ + char *escaped = xmlnode_get_data(node); + + char *unescaped = escaped ? purple_unescape_html(escaped) : NULL; + + g_free(escaped); + + return unescaped; +} + static char * xmlnode_to_str_helper(xmlnode *node, int *len, gboolean formatting, int depth) {
--- a/libpurple/xmlnode.h Fri Jun 08 12:43:57 2007 +0000 +++ b/libpurple/xmlnode.h Fri Jun 08 13:06:21 2007 +0000 @@ -124,14 +124,24 @@ void xmlnode_insert_data(xmlnode *node, const char *data, gssize size); /** - * Gets data from a node. + * Gets (escaped) data from a node. * * @param node The node to get data from. * - * @return The data from the node. You must g_free + * @return The data from the node. This data is in raw escaped format. + * You must g_free this string when finished using it. + */ +char *xmlnode_get_data(xmlnode *node); + +/** + * Gets unescaped data from a node. + * + * @param node The node to get data from. + * + * @return The data from the node, in unescaped form. You must g_free * this string when finished using it. */ -char *xmlnode_get_data(xmlnode *node); +char *xmlnode_get_data_unescaped(xmlnode *node); /** * Sets an attribute for a node.