Strophe 0.13 XMPP client library

Functions
stanza.c File Reference

Stanza creation and manipulation. More...

## Functions
xmpp_stanza_t * | xmpp_stanza_new (xmpp_ctx_t *ctx)
| Create a stanza object.
xmpp_stanza_t * | xmpp_stanza_clone (xmpp_stanza_t *stanza)
| Clone a stanza object.
static int | _stanza_copy_attributes (xmpp_stanza_t *dst, const xmpp_stanza_t *src)
xmpp_stanza_t * | xmpp_stanza_copy (const xmpp_stanza_t *stanza)
| Copy a stanza and its children.
int | xmpp_stanza_release (xmpp_stanza_t *stanza)
| Release a stanza object and all of its children.
xmpp_ctx_t * | xmpp_stanza_get_context (const xmpp_stanza_t *stanza)
| Get the strophe context that the stanza is associated with.
int | xmpp_stanza_is_text (xmpp_stanza_t *stanza)
| Determine if a stanza is a text node.
int | xmpp_stanza_is_tag (xmpp_stanza_t *stanza)
| Determine if a stanza is a tag node.
static char * | _escape_xml (xmpp_ctx_t *ctx, char *text)
static void | _render_update (int *written, int length, int lastwrite, size_t *left, char **ptr)
static int | _render_stanza_recursive (xmpp_stanza_t *stanza, char *buf, size_t buflen)
int | xmpp_stanza_to_text (xmpp_stanza_t *stanza, char **buf, size_t *buflen)
| Render a stanza object to text.
int | xmpp_stanza_set_name (xmpp_stanza_t *stanza, const char *name)
| Set the name of a stanza.
const char * | xmpp_stanza_get_name (xmpp_stanza_t *stanza)
| Get the stanza name.
int | xmpp_stanza_get_attribute_count (xmpp_stanza_t *stanza)
| Count the attributes in a stanza object.
int | xmpp_stanza_get_attributes (xmpp_stanza_t *stanza, const char **attr, int attrlen)
| Get all attributes for a stanza object.
int | xmpp_stanza_set_attribute (xmpp_stanza_t *stanza, const char *key, const char *value)
| Set an attribute for a stanza object.
int | xmpp_stanza_set_ns (xmpp_stanza_t *stanza, const char *ns)
| Set the stanza namespace.
int | xmpp_stanza_add_child_ex (xmpp_stanza_t *stanza, xmpp_stanza_t *child, int do_clone)
| Add a child stanza to a stanza object.
int | xmpp_stanza_add_child (xmpp_stanza_t *stanza, xmpp_stanza_t *child)
| Add a child stanza to a stanza object.
int | xmpp_stanza_set_text (xmpp_stanza_t *stanza, const char *text)
| Set the text data for a text stanza.
int | xmpp_stanza_set_text_with_size (xmpp_stanza_t *stanza, const char *text, size_t size)
| Set the text data for a text stanza.
const char * | xmpp_stanza_get_id (xmpp_stanza_t *stanza)
| Get the 'id' attribute of the stanza object.
const char * | xmpp_stanza_get_ns (xmpp_stanza_t *stanza)
| Get the namespace attribute of the stanza object.
const char * | xmpp_stanza_get_type (xmpp_stanza_t *stanza)
| Get the 'type' attribute of the stanza object.
const char * | xmpp_stanza_get_to (xmpp_stanza_t *stanza)
| Get the 'to' attribute of the stanza object.
const char * | xmpp_stanza_get_from (xmpp_stanza_t *stanza)
| Get the 'from' attribute of the stanza object.
xmpp_stanza_t * | xmpp_stanza_get_child_by_path (xmpp_stanza_t *stanza,...)
| Get the first child of stanza following a path-like list of names.
xmpp_stanza_t * | xmpp_stanza_get_child_by_name (xmpp_stanza_t *stanza, const char *name)
| Get the first child of stanza with name.
xmpp_stanza_t * | xmpp_stanza_get_child_by_ns (xmpp_stanza_t *stanza, const char *ns)
| Get the first child of a stanza with a given namespace.
xmpp_stanza_t * | xmpp_stanza_get_child_by_name_and_ns (xmpp_stanza_t *stanza, const char *name, const char *ns)
| Get the first child of stanza with name and a given namespace.
xmpp_stanza_t * | xmpp_stanza_get_children (xmpp_stanza_t *stanza)
| Get the list of children.
xmpp_stanza_t * | xmpp_stanza_get_next (xmpp_stanza_t *stanza)
| Get the next sibling of a stanza.
char * | xmpp_stanza_get_text (xmpp_stanza_t *stanza)
| Get the text data for a text stanza.
const char * | xmpp_stanza_get_text_ptr (xmpp_stanza_t *stanza)
| Get the text data pointer for a text stanza.
int | xmpp_stanza_set_id (xmpp_stanza_t *stanza, const char *id)
| Set the 'id' attribute of a stanza.
int | xmpp_stanza_set_type (xmpp_stanza_t *stanza, const char *type)
| Set the 'type' attribute of a stanza.
int | xmpp_stanza_set_to (xmpp_stanza_t *stanza, const char *to)
| Set the 'to' attribute of a stanza.
int | xmpp_stanza_set_from (xmpp_stanza_t *stanza, const char *from)
| Set the 'from' attribute of a stanza.
const char * | xmpp_stanza_get_attribute (xmpp_stanza_t *stanza, const char *name)
| Get an attribute from a stanza.
int | xmpp_stanza_del_attribute (xmpp_stanza_t *stanza, const char *name)
| Delete an attribute from a stanza.
xmpp_stanza_t * | xmpp_stanza_reply (xmpp_stanza_t *stanza)
| Create a stanza object in reply to another.
xmpp_stanza_t * | xmpp_stanza_reply_error (xmpp_stanza_t *stanza, const char *error_type, const char *condition, const char *text)
| Create an error stanza in reply to the provided stanza.
static xmpp_stanza_t * | _stanza_new_with_attrs (xmpp_ctx_t *ctx, const char *name, const char *type, const char *id, const char *to)
xmpp_stanza_t * | xmpp_message_new (xmpp_ctx_t *ctx, const char *type, const char *to, const char *id)
| Create a `<message/>` stanza object with given attributes.
char * | xmpp_message_get_body (xmpp_stanza_t *msg)
| Get text from `<body/>` child element.
int | xmpp_message_set_body (xmpp_stanza_t *msg, const char *text)
| Add `<body/>` child element to a `<message/>` stanza with the given text.
xmpp_stanza_t * | xmpp_iq_new (xmpp_ctx_t *ctx, const char *type, const char *id)
| Create an `<iq/>` stanza object with given attributes.
xmpp_stanza_t * | xmpp_presence_new (xmpp_ctx_t *ctx)
| Create a `<presence/>` stanza object.
xmpp_stanza_t * | xmpp_error_new (xmpp_ctx_t *ctx, xmpp_error_type_t type, const char *text)
| Create an <stream:error/> stanza object with given type and error text.
static void | _stub_stream_start (char *name, char **attrs, void *userdata)
static void | _stub_stream_end (char *name, void *userdata)
static void | _stream_stanza (xmpp_stanza_t *stanza, void *userdata)
xmpp_stanza_t * | xmpp_stanza_new_from_string (xmpp_ctx_t *ctx, const char *str)
| Create a stanza object from the string.

## Detailed Description

Stanza creation and manipulation.

## Function Documentation

## ◆ _stanza_copy_attributes()

static int _stanza_copy_attributes | ( | xmpp_stanza_t * | dst,
|  | const xmpp_stanza_t * | src )
| static

## ◆ _escape_xml()

static char * _escape_xml | ( | xmpp_ctx_t * | ctx,
|  | char * | text )
| static

## ◆ _render_update()

static void _render_update | ( | int * | written,
|  | int | length,
|  | int | lastwrite,
|  | size_t * | left,
|  | char ** | ptr )
| static

## ◆ _render_stanza_recursive()

static int _render_stanza_recursive | ( | xmpp_stanza_t * | stanza,
|  | char * | buf,
|  | size_t | buflen )
| static

## ◆ _stanza_new_with_attrs()

static xmpp_stanza_t * _stanza_new_with_attrs | ( | xmpp_ctx_t * | ctx,
|  | const char * | name,
|  | const char * | type,
|  | const char * | id,
|  | const char * | to )
| static

## ◆ _stub_stream_start()

static void _stub_stream_start | ( | char * | name,
|  | char ** | attrs,
|  | void * | userdata )
| static

## ◆ _stub_stream_end()

static void _stub_stream_end | ( | char * | name,
|  | void * | userdata )
| static

## ◆ _stream_stanza()

static void _stream_stanza | ( | xmpp_stanza_t * | stanza,
|  | void * | userdata )
| static