Strophe: stanza.c File Reference

Strophe 0.9 XMPP client library

Functions
stanza.c File Reference

## Functions
xmpp_stanza_t * | xmpp_stanza_new (xmpp_ctx_t *ctx)
| Create a stanza object. More...
xmpp_stanza_t * | xmpp_stanza_clone (xmpp_stanza_t *const stanza)
| Clone a stanza object. More...
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. More...
int | xmpp_stanza_release (xmpp_stanza_t *const stanza)
| Release a stanza object and all of its children. More...
int | xmpp_stanza_is_text (xmpp_stanza_t *const stanza)
| Determine if a stanza is a text node. More...
int | xmpp_stanza_is_tag (xmpp_stanza_t *const stanza)
| Determine if a stanza is a tag node. More...
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. More...
int | xmpp_stanza_set_name (xmpp_stanza_t *stanza, const char *const name)
| Set the name of a stanza. More...
const char * | xmpp_stanza_get_name (xmpp_stanza_t *const stanza)
| Get the stanza name. More...
int | xmpp_stanza_get_attribute_count (xmpp_stanza_t *const stanza)
| Count the attributes in a stanza object. More...
int | xmpp_stanza_get_attributes (xmpp_stanza_t *const stanza, const char **attr, int attrlen)
| Get all attributes for a stanza object. More...
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. More...
int | xmpp_stanza_set_ns (xmpp_stanza_t *const stanza, const char *const ns)
| Set the stanza namespace. More...
int | xmpp_stanza_add_child (xmpp_stanza_t *stanza, xmpp_stanza_t *child)
| Add a child stanza to a stanza object. More...
int | xmpp_stanza_set_text (xmpp_stanza_t *stanza, const char *const text)
| Set the text data for a text stanza. More...
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. More...
const char * | xmpp_stanza_get_id (xmpp_stanza_t *const stanza)
| Get the 'id' attribute of the stanza object. More...
const char * | xmpp_stanza_get_ns (xmpp_stanza_t *const stanza)
| Get the namespace attribute of the stanza object. More...
const char * | xmpp_stanza_get_type (xmpp_stanza_t *const stanza)
| Get the 'type' attribute of the stanza object. More...
const char * | xmpp_stanza_get_to (xmpp_stanza_t *const stanza)
| Get the 'to' attribute of the stanza object. More...
const char * | xmpp_stanza_get_from (xmpp_stanza_t *const stanza)
| Get the 'from' attribute of the stanza object. More...
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. More...
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. More...
xmpp_stanza_t * | xmpp_stanza_get_children (xmpp_stanza_t *const stanza)
| Get the list of children. More...
xmpp_stanza_t * | xmpp_stanza_get_next (xmpp_stanza_t *const stanza)
| Get the next sibling of a stanza. More...
char * | xmpp_stanza_get_text (xmpp_stanza_t *const stanza)
| Get the text data for a text stanza. More...
const char * | xmpp_stanza_get_text_ptr (xmpp_stanza_t *const stanza)
| Get the text data pointer for a text stanza. More...
int | xmpp_stanza_set_id (xmpp_stanza_t *const stanza, const char *const id)
| Set the 'id' attribute of a stanza. More...
int | xmpp_stanza_set_type (xmpp_stanza_t *const stanza, const char *const type)
| Set the 'type' attribute of a stanza. More...
int | xmpp_stanza_set_to (xmpp_stanza_t *const stanza, const char *const to)
| Set the 'to' attribute of a stanza. More...
int | xmpp_stanza_set_from (xmpp_stanza_t *const stanza, const char *const from)
| Set the 'from' attribute of a stanza. More...
const char * | xmpp_stanza_get_attribute (xmpp_stanza_t *const stanza, const char *const name)
| Get an attribute from a stanza. More...
int | xmpp_stanza_del_attribute (xmpp_stanza_t *const stanza, const char *const name)
| Delete an attribute from a stanza. More...
xmpp_stanza_t * | xmpp_stanza_reply (xmpp_stanza_t *const stanza)
| Create a stanza object in reply to another. More...
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. More...
char * | xmpp_message_get_body (xmpp_stanza_t *msg)
| Get text from <body> child element. More...
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. More...
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. More...
xmpp_stanza_t * | xmpp_presence_new (xmpp_ctx_t *ctx)
| Create a <presence> stanza object. More...
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. More...

## 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