merge of '7127441da3baee32f1d0a8057094490e615d3de6' release-2.1.0

Fri, 08 Jun 2007 13:10:32 +0000

author
Richard Nelson <wabz@pidgin.im>
date
Fri, 08 Jun 2007 13:10:32 +0000
branch
release-2.1.0
changeset 18135
dc4f5c0e5e63
parent 18131
7127441da3ba (diff)
parent 18134
47b947e1c8f1 (current diff)
child 18136
2c934db7aedd
child 18141
77cd035b2231

merge of '7127441da3baee32f1d0a8057094490e615d3de6'
and '47b947e1c8f15426ce8a6abe7ef7a22e0702c529'


committer: Luke Schierer <lschiere@pidgin.im>

--- a/libpurple/xmlnode.c	Fri Jun 08 12:43:57 2007 +0000
+++ b/libpurple/xmlnode.c	Fri Jun 08 13:10:32 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:10:32 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.

mercurial