Moved stanza_get_child_ny_name

This commit is contained in:
James Booth
2015-06-06 22:48:49 +01:00
parent 9fc69177da
commit 69afdf2cc5
4 changed files with 25 additions and 26 deletions

View File

@@ -144,6 +144,30 @@ stanza_get_child_by_ns(XMPPStanza *stanza, char *ns)
return NULL;
}
XMPPStanza*
stanza_get_child_by_name(XMPPStanza *stanza, char *name)
{
if (!stanza) {
return NULL;
}
if (!stanza->children) {
return NULL;
}
GList *curr_child = stanza->children;
while (curr_child) {
XMPPStanza *child = curr_child->data;
if (g_strcmp0(child->name, name) == 0) {
return child;
}
curr_child = g_list_next(curr_child);
}
return NULL;
}
static void
start_element(void *data, const char *element, const char **attributes)
{