From 67d430ed9dbaf4244fcebaf828edba2698e1691d Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Thu, 2 Jul 2009 17:59:09 +0100 Subject: util.c: properly re-implement lm_message_node_get_child_with_namespace using wocky API --- src/util.c | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) (limited to 'src/util.c') diff --git a/src/util.c b/src/util.c index 0d044b93b..7b8c59249 100644 --- a/src/util.c +++ b/src/util.c @@ -208,37 +208,20 @@ lm_message_node_get_child_with_namespace (LmMessageNode *node, const gchar *name, const gchar *ns) { + LmMessageNode *found; NodeIter i; + found = wocky_xmpp_node_get_child_ns (node, name, ns); + if (found != NULL) + return found; + for (i = node_iter (node); i; i = node_iter_next (i)) { - LmMessageNode *tmp = node_iter_data (i); - gchar *tag = NULL; - gboolean found; - - if (tp_strdiff (tmp->name, name)) - { - const gchar *suffix; - - suffix = strchr (tmp->name, ':'); - - if (suffix == NULL) - continue; - else - suffix++; - - if (tp_strdiff (suffix, name)) - continue; - - tag = g_strndup (tmp->name, suffix - tmp->name - 1); - } - - found = lm_message_node_has_namespace (tmp, ns, tag); - - g_free (tag); + LmMessageNode *child = node_iter_data (i); - if (found) - return tmp; + found = lm_message_node_get_child_with_namespace (child, name, ns); + if (found != NULL) + return found; } return NULL; -- cgit v1.2.3