stanza: add xmpp_stanza_add_child_ex()
This function is introduced by NetXMS project.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
- xmpp_conn_is_connecting()
|
||||
- xmpp_conn_is_connected()
|
||||
- xmpp_conn_is_disconnected()
|
||||
- xmpp_stanza_add_child_ex()
|
||||
- xmpp_stanza_get_context()
|
||||
|
||||
0.9.3
|
||||
|
||||
33
src/stanza.c
33
src/stanza.c
@@ -632,22 +632,29 @@ int xmpp_stanza_set_ns(xmpp_stanza_t * const stanza,
|
||||
}
|
||||
|
||||
/** Add a child stanza to a stanza object.
|
||||
* This function clones the child and appends it to the stanza object's
|
||||
* children.
|
||||
* If do_clone is TRUE, user keeps reference to the child stanza and must call
|
||||
* xmpp_stanza_release() to release the reference. If do_clone is FALSE, user
|
||||
* transfers ownership and must not neither call xmpp_stanza_release() for
|
||||
* the child stanza nor use it.
|
||||
*
|
||||
* @param stanza a Strophe stanza object
|
||||
* @param child the child stanza object
|
||||
* @param do_clone TRUE to increase ref count of child (default for
|
||||
* xmpp_stanza_add_child())
|
||||
*
|
||||
* @return XMPP_EOK (0) on success or a number less than 0 on failure
|
||||
*
|
||||
* @ingroup Stanza
|
||||
*/
|
||||
int xmpp_stanza_add_child(xmpp_stanza_t *stanza, xmpp_stanza_t *child)
|
||||
int xmpp_stanza_add_child_ex(xmpp_stanza_t *stanza, xmpp_stanza_t *child,
|
||||
int do_clone)
|
||||
{
|
||||
xmpp_stanza_t *s;
|
||||
|
||||
/* get a reference to the child */
|
||||
xmpp_stanza_clone(child);
|
||||
if (do_clone) {
|
||||
/* get a reference to the child */
|
||||
xmpp_stanza_clone(child);
|
||||
}
|
||||
|
||||
child->parent = stanza;
|
||||
|
||||
@@ -663,6 +670,22 @@ int xmpp_stanza_add_child(xmpp_stanza_t *stanza, xmpp_stanza_t *child)
|
||||
return XMPP_EOK;
|
||||
}
|
||||
|
||||
/** Add a child stanza to a stanza object.
|
||||
* This function clones the child and appends it to the stanza object's
|
||||
* children.
|
||||
*
|
||||
* @param stanza a Strophe stanza object
|
||||
* @param child the child stanza object
|
||||
*
|
||||
* @return XMPP_EOK (0) on success or a number less than 0 on failure
|
||||
*
|
||||
* @ingroup Stanza
|
||||
*/
|
||||
int xmpp_stanza_add_child(xmpp_stanza_t *stanza, xmpp_stanza_t *child)
|
||||
{
|
||||
return xmpp_stanza_add_child_ex(stanza, child, 1);
|
||||
}
|
||||
|
||||
/** Set the text data for a text stanza.
|
||||
* This function copies the text given and sets the stanza object's text to
|
||||
* it. Attempting to use this function on a stanza that has a name will
|
||||
|
||||
@@ -345,6 +345,8 @@ xmpp_stanza_t *xmpp_stanza_get_child_by_name_and_ns(xmpp_stanza_t * const stanza
|
||||
const char * const ns);
|
||||
xmpp_stanza_t *xmpp_stanza_get_next(xmpp_stanza_t * const stanza);
|
||||
int xmpp_stanza_add_child(xmpp_stanza_t *stanza, xmpp_stanza_t *child);
|
||||
int xmpp_stanza_add_child_ex(xmpp_stanza_t *stanza, xmpp_stanza_t *child,
|
||||
int do_clone);
|
||||
|
||||
const char *xmpp_stanza_get_attribute(xmpp_stanza_t * const stanza,
|
||||
const char * const name);
|
||||
|
||||
Reference in New Issue
Block a user