DebXWoodyHi. If I get a <message/> and I will check what's the message. Should I check the <name> of the child or shall I check the ns of the child?
Ge0rGan XML element is uniquely identified by the combination of namespace and tag name
DebXWoodylibstrophe provides two functions 'xmpp_stanza_get_child_by_ns' and 'xmpp_stanza_get_child_by_name'.
DebXWoodyGe0rG, I see, thanks!
MattJYes, any sensible API should let you combine both
lovetoxyeah that api makes no sense
Ge0rGDebXWoody: there are implementations that only use the tag name, because *often* tag names are globally unique. And then you can get very far until horrible things start to happen in silent and hideous ways
DebXWoodyThe api also provides this kind of message: xmpp_handler_add (xmpp_conn_t *const conn, xmpp_handler handler, const char *const ns, const char *const name, const char *const type, void *const userdata). But I try to understand.
lovetoxalso child? there can be children of "nam"
lovetoxalso child? there can be children of "name"
lovetoxdoes it return a list?
ZashAlso keep in mind that there's not a single child, each stanza (as well as any xml element) may have 0 or more child nodes (modulo schema etc)
DebXWoodylovetox, Looks like just the first element.
Ge0rGI think it would be a clean approach to define a handler for a certain namespace, and that handler would get passed all tags with that namespace
Zashiterators are also nice
DebXWoodyNow, I see! This may the reason why the implementation in profanity looks little bit complex. Calling a handler is just based on the first xml element. If the handler has to check what's the stanza about, it should check for something like 'list of stanza' get_stanza(name, ns).