changeset 23850:84c7bb2ca41f

Added xmlnode_get_parent.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Fri, 11 Jul 2008 01:20:08 +0000
parents 301bb7478f74
children 5736b1881bf4
files libpurple/protocols/jabber/jingle.c libpurple/xmlnode.c libpurple/xmlnode.h
diffstat 3 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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.