Strophe 0.9 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 *const stanza)
| Clone a stanza object.
static int | _stanza_copy_attributes (xmpp_stanza_t *dst, const xmpp_stanza_t *const src)
xmpp_stanza_t * | xmpp_stanza_copy (const xmpp_stanza_t *const stanza)
| Copy a stanza and its children.
int | xmpp_stanza_release (xmpp_stanza_t *const stanza)
| Release a stanza object and all of its children.
int | xmpp_stanza_is_text (xmpp_stanza_t *const stanza)
| Determine if a stanza is a text node.
int | xmpp_stanza_is_tag (xmpp_stanza_t *const stanza)
| Determine if a stanza is a tag node.
static char * | _escape_xml (xmpp_ctx_t *const ctx, char *text)
static void | _render_update (int *written, const int length, const int lastwrite, size_t *left, char **ptr)
static int | _render_stanza_recursive (xmpp_stanza_t *stanza, char *const buf, size_t const buflen)
int | xmpp_stanza_to_text (xmpp_stanza_t *stanza, char **const buf, size_t *const buflen)
| Render a stanza object to text.
int | xmpp_stanza_set_name (xmpp_stanza_t *stanza, const char *const name)
| Set the name of a stanza.
const char * | xmpp_stanza_get_name (xmpp_stanza_t *const stanza)
| Get the stanza name.
int | xmpp_stanza_get_attribute_count (xmpp_stanza_t *const stanza)
| Count the attributes in a stanza object.
int | xmpp_stanza_get_attributes (xmpp_stanza_t *const stanza, const char **attr, int attrlen)
| Get all attributes for a stanza object.
int | xmpp_stanza_set_attribute (xmpp_stanza_t *const stanza, const char *const key, const char *const value)
| Set an attribute for a stanza object.
int | xmpp_stanza_set_ns (xmpp_stanza_t *const stanza, const char *const ns)
| Set the stanza namespace.
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 *const text)
| Set the text data for a text stanza.
int | xmpp_stanza_set_text_with_size (xmpp_stanza_t *stanza, const char *const text, const size_t size)
| Set the text data for a text stanza.
const char * | xmpp_stanza_get_id (xmpp_stanza_t *const stanza)
| Get the 'id' attribute of the stanza object.
const char * | xmpp_stanza_get_ns (xmpp_stanza_t *const stanza)
| Get the namespace attribute of the stanza object.
const char * | xmpp_stanza_get_type (xmpp_stanza_t *const stanza)
| Get the 'type' attribute of the stanza object.
const char * | xmpp_stanza_get_to (xmpp_stanza_t *const stanza)
| Get the 'to' attribute of the stanza object.
const char * | xmpp_stanza_get_from (xmpp_stanza_t *const stanza)
| Get the 'from' attribute of the stanza object.
xmpp_stanza_t * | xmpp_stanza_get_child_by_name (xmpp_stanza_t *const stanza, const char *const name)
| Get the first child of stanza with name.
xmpp_stanza_t * | xmpp_stanza_get_child_by_ns (xmpp_stanza_t *const stanza, const char *const 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 *const stanza, const char *const name, const char *const ns)
| Get the first child of stanza with name and a given namespace.
xmpp_stanza_t * | xmpp_stanza_get_children (xmpp_stanza_t *const stanza)
| Get the list of children.
xmpp_stanza_t * | xmpp_stanza_get_next (xmpp_stanza_t *const stanza)
| Get the next sibling of a stanza.
char * | xmpp_stanza_get_text (xmpp_stanza_t *const stanza)
| Get the text data for a text stanza.
const char * | xmpp_stanza_get_text_ptr (xmpp_stanza_t *const stanza)
| Get the text data pointer for a text stanza.
int | xmpp_stanza_set_id (xmpp_stanza_t *const stanza, const char *const id)
| Set the 'id' attribute of a stanza.
int | xmpp_stanza_set_type (xmpp_stanza_t *const stanza, const char *const type)
| Set the 'type' attribute of a stanza.
int | xmpp_stanza_set_to (xmpp_stanza_t *const stanza, const char *const to)
| Set the 'to' attribute of a stanza.
int | xmpp_stanza_set_from (xmpp_stanza_t *const stanza, const char *const from)
| Set the 'from' attribute of a stanza.
const char * | xmpp_stanza_get_attribute (xmpp_stanza_t *const stanza, const char *const name)
| Get an attribute from a stanza.
int | xmpp_stanza_del_attribute (xmpp_stanza_t *const stanza, const char *const name)
| Delete an attribute from a stanza.
xmpp_stanza_t * | xmpp_stanza_reply (xmpp_stanza_t *const stanza)
| Create a stanza object in reply to another.
static xmpp_stanza_t * | _stanza_new_with_attrs (xmpp_ctx_t *ctx, const char *const name, const char *const type, const char *const id, const char *const to)
xmpp_stanza_t * | xmpp_message_new (xmpp_ctx_t *ctx, const char *const type, const char *const to, const char *const 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 *const 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 *const type, const char *const 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 const type, const char *const 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 *const | src )
| static

## ◆ _escape_xml()

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

## ◆ _render_update()

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

## ◆ _render_stanza_recursive()

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

## ◆ _stanza_new_with_attrs()

static xmpp_stanza_t * _stanza_new_with_attrs | ( | xmpp_ctx_t * | ctx,
|  | const char *const | name,
|  | const char *const | type,
|  | const char *const | id,
|  | const char *const | 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