jdev - 2020-06-16


  1. DebXWoody

    Hi. 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?

  2. Ge0rG

    an XML element is uniquely identified by the combination of namespace and tag name

  3. DebXWoody

    libstrophe provides two functions 'xmpp_stanza_get_child_by_ns' and 'xmpp_stanza_get_child_by_name'.

  4. DebXWoody

    Ge0rG, I see, thanks!

  5. MattJ

    Yes, any sensible API should let you combine both

  6. lovetox

    yeah that api makes no sense

  7. Ge0rG

    DebXWoody: 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

  8. DebXWoody

    The 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.

  9. lovetox

    also child? there can be children of "nam"

  10. lovetox

    also child? there can be children of "name"

  11. lovetox

    does it return a list?

  12. Zash

    Also 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)

  13. DebXWoody

    lovetox, Looks like just the first element.

  14. Ge0rG

    I 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

  15. Zash

    iterators are also nice

  16. DebXWoody

    Now, 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).