summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2012-01-30 17:27:17 +0000
committerWill Thompson <will.thompson@collabora.co.uk>2012-01-31 17:40:45 +0000
commitd8a2087662fe895eef24296fab7755c5b5ead197 (patch)
tree0c1aafd3b543d7d5c9ca98d6b53701b1f7eaa8fd
parent7b258fc5ea423927878cd63e6f0a01ffe11d2869 (diff)
conn-olpc: adopt lm_message_node_get_child_with_namespace
This is now only used within this code, and I am too scared of breaking code I know nothing about to stop using it here too, so I'm just going to leave it here, probably with a new name.
-rw-r--r--src/conn-olpc.c34
-rw-r--r--src/util.c34
-rw-r--r--src/util.h2
3 files changed, 34 insertions, 36 deletions
diff --git a/src/conn-olpc.c b/src/conn-olpc.c
index 2b99cc039..d69e5832f 100644
--- a/src/conn-olpc.c
+++ b/src/conn-olpc.c
@@ -50,6 +50,40 @@ static gboolean
update_activities_properties (GabbleConnection *conn, const gchar *contact,
WockyStanza *msg);
+/*
+ * If you are trying to get a direct child of a node in a particular namespace,
+ * use wocky_node_get_child_ns(), not this function.
+ *
+ * This function performs a depth-first search on @node to find any element
+ * named @name in namespace @ns. This is usually not what you want because you
+ * don't want a depth-first search of the entire hierarchy: you know at what
+ * level of nesting you expect to find an element. Using this function rather
+ * than wocky_node_get_child_ns() a couple of times opens you up to accepting
+ * wildly misconstructed stanzas. Please think of the kittens.
+ */
+static WockyNode *
+lm_message_node_get_child_with_namespace (WockyNode *node,
+ const gchar *name,
+ const gchar *ns)
+{
+ WockyNode *found, *child;
+ WockyNodeIter i;
+
+ found = wocky_node_get_child_ns (node, name, ns);
+ if (found != NULL)
+ return found;
+
+ wocky_node_iter_init (&i, node, NULL, NULL);
+ while (wocky_node_iter_next (&i, &child))
+ {
+ found = lm_message_node_get_child_with_namespace (child, name, ns);
+ if (found != NULL)
+ return found;
+ }
+
+ return NULL;
+}
+
/* Returns TRUE if it actually contributed something, else FALSE.
*/
static gboolean
diff --git a/src/util.c b/src/util.c
index 9aa0b666c..beb3697a4 100644
--- a/src/util.c
+++ b/src/util.c
@@ -162,40 +162,6 @@ lm_message_node_add_own_nick (WockyNode *node,
g_free (nick);
}
-/*
- * If you are trying to get a direct child of a node in a particular namespace,
- * use wocky_node_get_child_ns(), not this function.
- *
- * This function performs a depth-first search on @node to find any element
- * named @name in namespace @ns. This is usually not what you want because you
- * don't want a depth-first search of the entire hierarchy: you know at what
- * level of nesting you expect to find an element. Using this function rather
- * than wocky_node_get_child_ns() a couple of times opens you up to accepting
- * wildly misconstructed stanzas. Please think of the kittens.
- */
-WockyNode *
-lm_message_node_get_child_with_namespace (WockyNode *node,
- const gchar *name,
- const gchar *ns)
-{
- WockyNode *found, *child;
- WockyNodeIter i;
-
- found = wocky_node_get_child_ns (node, name, ns);
- if (found != NULL)
- return found;
-
- wocky_node_iter_init (&i, node, NULL, NULL);
- while (wocky_node_iter_next (&i, &child))
- {
- found = lm_message_node_get_child_with_namespace (child, name, ns);
- if (found != NULL)
- return found;
- }
-
- return NULL;
-}
-
/**
* gabble_get_room_handle_from_jid:
* @room_repo: The %TP_HANDLE_TYPE_ROOM handle repository
diff --git a/src/util.h b/src/util.h
index e92439983..9aba4170b 100644
--- a/src/util.h
+++ b/src/util.h
@@ -45,8 +45,6 @@ gchar *gabble_generate_id (void);
void lm_message_node_add_own_nick (WockyNode *node,
GabbleConnection *conn);
-WockyNode *lm_message_node_get_child_with_namespace (WockyNode *node,
- const gchar *name, const gchar *ns);
G_GNUC_WARN_UNUSED_RESULT
gchar *gabble_encode_jid (const gchar *node, const gchar *domain,