changeset 28117:1662dbdac18c

Add two XMLNode accessors for iterating through the children of an XMLNode. Closes #10130.
author Paul Aurich <paul@darkrain42.org>
date Sat, 29 Aug 2009 02:36:27 +0000
parents caa94dfa37f1
children d7cfffdd35e6
files ChangeLog.API libpurple/plugins/perl/common/XMLNode.xs
diffstat 2 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog.API	Sat Aug 29 02:32:16 2009 +0000
+++ b/ChangeLog.API	Sat Aug 29 02:36:27 2009 +0000
@@ -1,5 +1,14 @@
 Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul
 
+version 2.6.2 (09/??/2009):
+	Perl:
+		Added:
+		* Purple::XMLNode::get_next(), which returns the next neighbor tag of
+		  the current node.
+		Changed:
+		* Purple::XMLNode::get_child() will return the first child node if
+		  passed "" or undef as the name of the node.
+
 version 2.6.1 (08/18/2009):
 	No changes
 
--- a/libpurple/plugins/perl/common/XMLNode.xs	Sat Aug 29 02:32:16 2009 +0000
+++ b/libpurple/plugins/perl/common/XMLNode.xs	Sat Aug 29 02:36:27 2009 +0000
@@ -32,6 +32,18 @@
 xmlnode_get_child(parent, name)
 	Purple::XMLNode parent
 	const char *name
+PREINIT:
+	xmlnode *tmp;
+CODE:
+	if (!name || *name == '\0') {
+		tmp = parent->child;
+		while (tmp && tmp->type != XMLNODE_TYPE_TAG)
+			tmp = tmp->next;
+		RETVAL = tmp;
+	} else
+		RETVAL = xmlnode_get_child(parent, name);
+OUTPUT:
+	RETVAL
 
 Purple::XMLNode
 xmlnode_get_child_with_namespace(parent, name, xmlns)
@@ -44,6 +56,19 @@
 	Purple::XMLNode node
 
 Purple::XMLNode
+xmlnode_get_next(node)
+	Purple::XMLNode node
+PREINIT:
+	xmlnode *tmp;
+CODE:
+	tmp = node->next;
+	while (tmp && tmp->type != XMLNODE_TYPE_TAG)
+		tmp = tmp->next;
+	RETVAL = tmp;
+OUTPUT:
+	RETVAL
+
+Purple::XMLNode
 xmlnode_get_next_twin(node)
 	Purple::XMLNode node