Added xmlnode_get_parent. soc.2008.vv

Fri, 11 Jul 2008 01:20:08 +0000

author
Michael Ruprecht <maiku@pidgin.im>
date
Fri, 11 Jul 2008 01:20:08 +0000
branch
soc.2008.vv
changeset 23750
57baab09bf45
parent 23749
526619469cc1
child 23751
c24e0bf2b242

Added xmlnode_get_parent.

libpurple/protocols/jabber/jingle.c file | annotate | diff | comparison | revisions
libpurple/xmlnode.c file | annotate | diff | comparison | revisions
libpurple/xmlnode.h file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/jabber/jingle.c	Fri Jul 11 01:04:44 2008 +0000
+++ b/libpurple/protocols/jabber/jingle.c	Fri Jul 11 01:20:08 2008 +0000
@@ -590,7 +590,7 @@
 	JabberIq *result = jabber_iq_new(
 			jabber_jingle_session_get_js(session),
 			JABBER_IQ_RESULT);
-	xmlnode *packet = jingle->parent;
+	xmlnode *packet = xmlnode_get_parent(jingle);
 	jabber_iq_set_id(result, xmlnode_get_attrib(packet, "id"));
 	xmlnode_set_attrib(result->node, "from", xmlnode_get_attrib(packet, "to"));
 	xmlnode_set_attrib(result->node, "to", xmlnode_get_attrib(packet, "from"));
@@ -1361,7 +1361,7 @@
 	if (g_list_length(remote_candidates) > 0) {
 		purple_media_add_remote_candidates(session->media,
 						   xmlnode_get_attrib(content, "name"),
-						   xmlnode_get_attrib(jingle->parent, "from"),
+						   xmlnode_get_attrib(xmlnode_get_parent(jingle), "from"),
 						   remote_candidates);
 		fs_candidate_list_destroy(remote_candidates);
 	}
--- a/libpurple/xmlnode.c	Fri Jul 11 01:04:44 2008 +0000
+++ b/libpurple/xmlnode.c	Fri Jul 11 01:20:08 2008 +0000
@@ -307,6 +307,12 @@
 	return node->prefix;
 }
 
+xmlnode *xmlnode_get_parent(const xmlnode *child)
+{
+	g_return_val_if_fail(child != NULL, NULL);
+	return child->parent;
+}
+
 void
 xmlnode_free(xmlnode *node)
 {
--- a/libpurple/xmlnode.h	Fri Jul 11 01:04:44 2008 +0000
+++ b/libpurple/xmlnode.h	Fri Jul 11 01:20:08 2008 +0000
@@ -246,6 +246,15 @@
 const char *xmlnode_get_prefix(xmlnode *node);
 
 /**
+ * Gets the parent node.
+ *
+ * @param child The child node.
+ *
+ * @return The parent or NULL.
+ */
+xmlnode *xmlnode_get_parent(const xmlnode *child);
+
+/**
  * Returns the node in a string of xml.
  *
  * @param node The starting node to output.

mercurial