Strophe 0.12
XMPP client library
Typedefs | Functions
handler.c File Reference

Event handler management. More...

Typedefs

typedef int(* xmpp_void_handler) ()
 

Functions

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

Detailed Description

Event handler management.

Typedef Documentation

◆ xmpp_void_handler

typedef int(* xmpp_void_handler) ()

Function Documentation

◆ _handler_item_remove()

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

◆ _free_handlist_item()

static void _free_handlist_item ( xmpp_ctx_t *  ctx,
xmpp_handlist_t *  item 
)
static

◆ handler_fire_stanza()

void handler_fire_stanza ( xmpp_conn_t *  conn,
xmpp_stanza_t *  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
conna Strophe connection object
stanzaa Strophe stanza object

◆ handler_fire_timed()

uint64_t handler_fire_timed ( xmpp_ctx_t *  ctx)

Fire off all timed handlers that are ready.

This function is called internally by the event loop.

Parameters
ctxa 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
conna Strophe connection object
user_onlywhether to reset all handlers or only user ones

◆ _timed_handler_add()

static void _timed_handler_add ( xmpp_ctx_t *  ctx,
xmpp_handlist_t **  handlers_list,
xmpp_void_handler  handler,
unsigned long  period,
void *  userdata,
int  user_handler 
)
static

◆ _timed_handler_delete()

static void _timed_handler_delete ( xmpp_ctx_t *  ctx,
xmpp_handlist_t **  handlers_list,
xmpp_void_handler  handler 
)
static

◆ _id_handler_add()

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

◆ _dup_string()

static int _dup_string ( xmpp_ctx_t *  ctx,
const char *  src,
char **  dest 
)
static

◆ _handler_add()

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

◆ handler_add_timed()

void handler_add_timed ( xmpp_conn_t *  conn,
xmpp_timed_handler  handler,
unsigned long  period,
void *  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
conna Strophe connection object
handlera function pointer to a timed handler
periodthe time in milliseconds between firings
userdataan opaque data pointer that will be passed to the handler

◆ handler_add_id()

void handler_add_id ( xmpp_conn_t *  conn,
xmpp_handler  handler,
const char *  id,
void *  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
conna Strophe connection object
handlera function pointer to a stanza handler
ida string with the id
userdataan opaque data pointer that will be passed to the handler

◆ handler_add()

void handler_add ( xmpp_conn_t *  conn,
xmpp_handler  handler,
const char *  ns,
const char *  name,
const char *  type,
void *  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
conna Strophe connection object
handlera function pointer to a stanza handler
nsa string with the namespace to match
namea string with the stanza name to match
typea string with the 'type' attribute value to match
userdataan 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
conna Strophe connection object