lm_message_node_get_child_with_namespace() is an incredible function that recursively searches a stanza for an element with a particular name. It's used in all kinds of places, but it really shouldn't be: the structure of stanzas does matter. This function makes us accept really malformed stanzas, making it harder to follow what's going on or—in the case of Tubes, where the most up-to-date documentation of the protocol is the code—know what the wire protocol is actually meant to look like.
This would be a good place for someone looking to get familiar with the XMPP protocols used in Gabble to get started.
Each place where lm_message_node_get_child_with_namespace() is used:
• Check whether it could be replaced by wocky_node_get_child_ns(). For example, lots of code uses this function to pull the top-level query element out of an IQ stanzas which look like this:
<iq from='foo@bar' type='get' id='333'>
In this case, a call to lm_message_node_get_child_with_namespace (iq_node, "query", "blahblahblah") should be directly replaced by a call to wocky_node_get_child_ns (iq_node, "query", "blahblahblah").
• Otherwise, check what structure the stanza is documented to have in the relevant XEP, and traverse the structure explicitly. For example, consider this code:
bar = lm_message_node_get_child_with_namespace (message_node, "bar", "urn:xmpp:bar");
If it's retrieving the 'bar' node from a stanza which looks like this:
Then the corrected code would be as follows:
WockyNode *bar = NULL;
WockyNode *foo = wocky_node_get_child_ns (message_node, "foo", "urn:xmpp:foo");
if (foo != NULL)
bar = wocky_node_get_child_ns (foo, "bar", "urn:xmpp:bar");
• If it's not obvious, check the relevant XEPs and test cases to figure out what's meant to be going on, or ask on #telepathy
lm_message_node_get_child_with_namespace() is no more to be found in source code. This bug is thus obsolete.
For what it's worth, it does still exist, albeit under a different name: after getting rid of all other uses, I moved it into conn-olpc.c http://cgit.freedesktop.org/telepathy/telepathy-gabble/commit/?id=d8a20876 and renamed it for clarity: http://cgit.freedesktop.org/telepathy/telepathy-gabble/commit/?id=6c68414
Thanks for clearing up the obsolete bug!