Strophe  0.9
XMPP client library
Functions
Stanza and timed event handlers

Functions

void xmpp_timed_handler_delete (xmpp_conn_t *const conn, xmpp_timed_handler handler)
 Delete a timed handler. More...
 
void xmpp_id_handler_delete (xmpp_conn_t *const conn, xmpp_handler handler, const char *const id)
 Delete an id based stanza handler. More...
 
void xmpp_handler_delete (xmpp_conn_t *const conn, xmpp_handler handler)
 Delete a stanza handler. More...
 
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. More...
 
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. More...
 
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. More...
 

Detailed Description

Function Documentation

◆ xmpp_timed_handler_delete()

void xmpp_timed_handler_delete ( xmpp_conn_t *const  conn,
xmpp_timed_handler  handler 
)

Delete a timed handler.

Parameters
conna Strophe connection object
handlerfunction pointer to the handler

◆ xmpp_id_handler_delete()

void xmpp_id_handler_delete ( xmpp_conn_t *const  conn,
xmpp_handler  handler,
const char *const  id 
)

Delete an id based stanza handler.

Parameters
conna Strophe connection object
handlera function pointer to a stanza handler
ida string containing the id the handler is for

◆ xmpp_handler_delete()

void xmpp_handler_delete ( xmpp_conn_t *const  conn,
xmpp_handler  handler 
)

Delete a stanza handler.

Parameters
conna Strophe connection object
handlera function pointer to a stanza handler

◆ xmpp_timed_handler_add()

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.

The handler will fire for the first time once the period has elapsed, and continue firing regularly after that. Strophe will try its best to fire handlers as close to the period times as it can, but accuracy will vary depending on the resolution of the event loop.

If the handler function returns true, it will be kept, and if it returns false, it will be deleted from the list of handlers.

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

◆ xmpp_id_handler_add()

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.

This function adds a stanza handler for an <iq/> stanza of type 'result' or 'error' with a specific id attribute. This can be used to handle responses to specific <iq/>s.

If the handler function returns true, it will be kept, and if it returns false, it will be deleted from the list of handlers.

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

◆ xmpp_handler_add()

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.

This function is used to add a stanza handler to a connection. The handler will be called when the any of the filters match. The name filter matches to the top level stanza name. The type filter matches the 'type' attribute of the top level stanza. The ns filter matches the namespace ('xmlns' attribute) of either the top level stanza or any of it's immediate children (this allows you do handle specific <iq/> stanzas based on the <query/> child namespace.

If the handler function returns true, it will be kept, and if it returns false, it will be deleted from the list of handlers.

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 to match
userdataan opaque data pointer that will be passed to the handler