Strophe 0.9 XMPP client library

Functions
handler.c File Reference

Event handler management. More...

## Functions
static void | _handler_item_remove (xmpp_handlist_t **head, xmpp_handlist_t *item)
void | handler_fire_stanza (xmpp_conn_t *const conn, xmpp_stanza_t *const stanza)
| Fire off all stanza handlers that match.
uint64_t | handler_fire_timed (xmpp_ctx_t *const ctx)
| Fire off all timed handlers that are ready.
void | handler_reset_timed (xmpp_conn_t *conn, int user_only)
| Reset all timed handlers.
static void | _timed_handler_add (xmpp_conn_t *const conn, xmpp_timed_handler handler, const unsigned long period, void *const userdata, const int user_handler)
void | xmpp_timed_handler_delete (xmpp_conn_t *const conn, xmpp_timed_handler handler)
| Delete a timed handler.
static void | _id_handler_add (xmpp_conn_t *const conn, xmpp_handler handler, const char *const id, void *const userdata, int user_handler)
void | xmpp_id_handler_delete (xmpp_conn_t *const conn, xmpp_handler handler, const char *const id)
| Delete an id based stanza handler.
static void | _handler_add (xmpp_conn_t *const conn, xmpp_handler handler, const char *const ns, const char *const name, const char *const type, void *const userdata, int user_handler)
void | xmpp_handler_delete (xmpp_conn_t *const conn, xmpp_handler handler)
| Delete a stanza handler.
void | xmpp_timed_handler_add (xmpp_conn_t *const conn, xmpp_timed_handler handler, const unsigned long period, void *const userdata)
| Add a timed handler.
void | handler_add_timed (xmpp_conn_t *const conn, xmpp_timed_handler handler, const unsigned long period, void *const userdata)
| Add a timed system handler.
void | xmpp_id_handler_add (xmpp_conn_t *const conn, xmpp_handler handler, const char *const id, void *const userdata)
| Add an id based stanza handler.
void | handler_add_id (xmpp_conn_t *const conn, xmpp_handler handler, const char *const id, void *const userdata)
| Add an id based system stanza handler.
void | xmpp_handler_add (xmpp_conn_t *const conn, xmpp_handler handler, const char *const ns, const char *const name, const char *const type, void *const userdata)
| Add a stanza handler.
void | handler_add (xmpp_conn_t *const conn, xmpp_handler handler, const char *const ns, const char *const name, const char *const type, void *const userdata)
| Add a system stanza handler.
void | handler_system_delete_all (xmpp_conn_t *conn)
| Delete all system handlers.

## Detailed Description

Event handler management.

## Function Documentation

## ◆ _handler_item_remove()

static void _handler_item_remove | ( | xmpp_handlist_t ** | head,
|  | xmpp_handlist_t * | item )
| static

## ◆ handler_fire_stanza()

void handler_fire_stanza | ( | xmpp_conn_t *const | conn,
|  | xmpp_stanza_t *const | stanza )

Fire off all stanza handlers that match.

This function is called internally by the event loop whenever stanzas are received from the XMPP server.

Parameters

  conn | a Strophe connection object
  stanza | a Strophe stanza object

## ◆ handler_fire_timed()

uint64_t handler_fire_timed | ( | xmpp_ctx_t *const | ctx | ) |

Fire off all timed handlers that are ready.

This function is called internally by the event loop.

Parameters

  ctx | a Strophe context object

Returns
  the time in milliseconds until the next handler will be ready

## ◆ handler_reset_timed()

void handler_reset_timed | ( | xmpp_conn_t * | conn,
|  | int | user_only )

Reset all timed handlers.

This function is called internally when a connection is successful.

Parameters

  conn | a Strophe connection object
  user_only | whether to reset all handlers or only user ones

## ◆ _timed_handler_add()

static void _timed_handler_add | ( | xmpp_conn_t *const | conn,
|  | xmpp_timed_handler | handler,
|  | const unsigned long | period,
|  | void *const | userdata,
|  | const int | user_handler )
| static

## ◆ _id_handler_add()

static void _id_handler_add | ( | xmpp_conn_t *const | conn,
|  | xmpp_handler | handler,
|  | const char *const | id,
|  | void *const | userdata,
|  | int | user_handler )
| static

## ◆ _handler_add()

static void _handler_add | ( | xmpp_conn_t *const | conn,
|  | xmpp_handler | handler,
|  | const char *const | ns,
|  | const char *const | name,
|  | const char *const | type,
|  | void *const | userdata,
|  | int | user_handler )
| static

## ◆ handler_add_timed()

void handler_add_timed | ( | xmpp_conn_t *const | conn,
|  | xmpp_timed_handler | handler,
|  | const unsigned long | period,
|  | void *const | userdata )

Add a timed system handler.

This function is used to add internal timed handlers and should not be used outside of the library.

Parameters

  conn | a Strophe connection object
  handler | a function pointer to a timed handler
  period | the time in milliseconds between firings
  userdata | an opaque data pointer that will be passed to the handler

## ◆ handler_add_id()

void handler_add_id | ( | xmpp_conn_t *const | conn,
|  | xmpp_handler | handler,
|  | const char *const | id,
|  | void *const | userdata )

Add an id based system stanza handler.

This function is used to add internal id based stanza handlers and should not be used outside of the library.

Parameters

  conn | a Strophe connection object
  handler | a function pointer to a stanza handler
  id | a string with the id
  userdata | an opaque data pointer that will be passed to the handler

## ◆ handler_add()

void handler_add | ( | xmpp_conn_t *const | conn,
|  | xmpp_handler | handler,
|  | const char *const | ns,
|  | const char *const | name,
|  | const char *const | type,
|  | void *const | userdata )

Add a system stanza handler.

This function is used to add internal stanza handlers and should not be used outside of the library.

Parameters

  conn | a Strophe connection object
  handler | a function pointer to a stanza handler
  ns | a string with the namespace to match
  name | a string with the stanza name to match
  type | a string with the 'type' attribute value to match
  userdata | an opaque data pointer that will be passed to the handler

## ◆ handler_system_delete_all()

void handler_system_delete_all | ( | xmpp_conn_t * | conn | ) |

Delete all system handlers.

This function is used to reset conn object before re-connecting.

Parameters

  conn | a Strophe connection object