Implement xmpp_stanza_del_attribute()
This commit is contained in:
committed by
Dmitry Podgorny
parent
0d4bcc0228
commit
21f742f888
21
src/stanza.c
21
src/stanza.c
@@ -1042,3 +1042,24 @@ char *xmpp_stanza_get_attribute(xmpp_stanza_t * const stanza,
|
|||||||
|
|
||||||
return hash_get(stanza->attributes, name);
|
return hash_get(stanza->attributes, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Delete an attribute from a stanza.
|
||||||
|
*
|
||||||
|
* @param stanza a Strophe stanza object
|
||||||
|
* @param name a string containing attribute name
|
||||||
|
*
|
||||||
|
* @return XMPP_EOK (0) on success or a number less than 0 on failure
|
||||||
|
*
|
||||||
|
* @ingroup Stanza
|
||||||
|
*/
|
||||||
|
int xmpp_stanza_del_attribute(xmpp_stanza_t * const stanza,
|
||||||
|
const char * const name)
|
||||||
|
{
|
||||||
|
if (stanza->type != XMPP_STANZA_TAG)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (!stanza->attributes)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return hash_drop(stanza->attributes, name);
|
||||||
|
}
|
||||||
|
|||||||
@@ -342,6 +342,9 @@ int xmpp_stanza_set_text_with_size(xmpp_stanza_t *stanza,
|
|||||||
const char * const text,
|
const char * const text,
|
||||||
const size_t size);
|
const size_t size);
|
||||||
|
|
||||||
|
int xmpp_stanza_del_attribute(xmpp_stanza_t * const stanza,
|
||||||
|
const char * const name);
|
||||||
|
|
||||||
/* common stanza helpers */
|
/* common stanza helpers */
|
||||||
char *xmpp_stanza_get_type(xmpp_stanza_t * const stanza);
|
char *xmpp_stanza_get_type(xmpp_stanza_t * const stanza);
|
||||||
char *xmpp_stanza_get_id(xmpp_stanza_t * const stanza);
|
char *xmpp_stanza_get_id(xmpp_stanza_t * const stanza);
|
||||||
|
|||||||
Reference in New Issue
Block a user