summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-07-23 16:53:12 +0100
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-09-11 15:49:18 +0100
commit657bad3c99564a03e86f923b24280e0cde6a1a91 (patch)
treecf89feb10bdd6e83f1def93d8b76b6b3339997ec /src/util.c
parent135022790388c7b1553106714e149f20c435c7e3 (diff)
util.c: re-implement lm_message_node_get_attribute_with_namespace using the proper wocky API
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c50
1 files changed, 1 insertions, 49 deletions
diff --git a/src/util.c b/src/util.c
index ed54be83..213418aa 100644
--- a/src/util.c
+++ b/src/util.c
@@ -162,23 +162,6 @@ lm_message_node_get_child_any_ns (LmMessageNode *node, const gchar *name)
return NULL;
}
-static const gchar *
-find_namespace_of_prefix (LmMessageNode *node,
- const gchar *prefix)
-{
- gchar *attr = g_strdup_printf ("xmlns:%s", prefix);
- const gchar *node_ns = NULL;
-
- /* find the namespace in this node or its parents */
- for (; (node != NULL) && (node_ns == NULL); node = node->parent)
- {
- node_ns = lm_message_node_get_attribute (node, attr);
- }
-
- g_free (attr);
- return node_ns;
-}
-
const gchar *
lm_message_node_get_namespace (LmMessageNode *node)
{
@@ -1001,38 +984,7 @@ lm_message_node_get_attribute_with_namespace (LmMessageNode *node,
const gchar *attribute,
const gchar *ns)
{
- GSList *l;
- const gchar *result = NULL;
-
- g_return_val_if_fail (node != NULL, NULL);
- g_return_val_if_fail (attribute != NULL, NULL);
- g_return_val_if_fail (ns != NULL, NULL);
-
- for (l = node->attributes; l != NULL && result == NULL; l = g_slist_next (l))
- {
- /* This is NOT part of loudmouth API; it depends LM internals */
- Attribute *attr = (Attribute *) l->data;
- gchar **pair;
-
- pair = g_strsplit (attr->key, ":", 2);
-
- if (tp_strdiff (pair[1], attribute))
- /* no prefix (pair[1] == NULL) or the local-name is not the
- * attribute we are looking for */
- goto next_attribute;
-
- if (tp_strdiff (find_namespace_of_prefix (node, pair[0]), ns))
- /* wrong namespace */
- goto next_attribute;
-
- result = attr->value;
-
-next_attribute:
- g_strfreev (pair);
- continue;
- }
-
- return result;
+ return wocky_xmpp_node_get_attribute_ns (node, attribute, ns);
}
GPtrArray *