[telepathy-gabble/master] util.c: properly re-implement lm_message_node_get_child_with_namespace using wocky API

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Fri Sep 11 07:56:18 PDT 2009


---
 src/util.c |   35 +++++++++--------------------------
 1 files changed, 9 insertions(+), 26 deletions(-)

diff --git a/src/util.c b/src/util.c
index 0d044b9..7b8c592 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;
-- 
1.5.6.5




More information about the telepathy-commits mailing list