stanza: add xmpp_stanza_new_from_string()

This function creates a stanza object from a string. The string must
contain a single complete stanza. Multiple stanzas will lead to memory
leak and this is not handled in the patch.
This commit is contained in:
Dmitry Podgorny
2020-06-04 03:40:48 +03:00
parent 3dcc5a60f2
commit 428681a185
4 changed files with 95 additions and 1 deletions

View File

@@ -330,6 +330,7 @@ void xmpp_register_stanza_handler(conn, stanza, xmlns, type, handler)
/* allocate and initialize a blank stanza */
xmpp_stanza_t *xmpp_stanza_new(xmpp_ctx_t *ctx);
xmpp_stanza_t *xmpp_stanza_new_from_string(xmpp_ctx_t *ctx, const char *str);
/* clone a stanza */
xmpp_stanza_t *xmpp_stanza_clone(xmpp_stanza_t *const stanza);