modules.cc File Reference

jsm module API More...

#include "jsm.h"

Functions

void js_mapi_register (jsmi si, event e, mcall c, void *arg)
void js_mapi_session (event e, session s, mcall c, void *arg)
void js_mapi_create_additional_iq_result (mapi m, const char *name, const char *prefix, const char *ns_iri)
int js_mapi_call (jsmi si, event e, jpacket packet, udata user, session s)
int js_mapi_call2 (jsmi si, event e, jpacket packet, udata user, session s, xmlnode serialization_node)


Detailed Description

jsm module API


Function Documentation

int js_mapi_call ( jsmi  si,
event  e,
jpacket  packet,
udata  user,
session  s 
)

call all the module callbacks for a phase

Addes callbacks to the ignore mask for a given packet type if they return M_IGNORE.

Parameters:
si the session manager instance data (MUST be NULL for a es_* event)
e call the modules for which event type
packet the packet being processed, may be NULL
user the user data for the current session (or the sender for e_SERVER if it is local), may be NULL
s the session for which to call the event, may be NULL
Returns:
1 if the call was handled by a module, 0 if it wasn't handled

References js_mapi_call2().

Referenced by _js_authreg_auth(), _js_authreg_register(), _js_session_end(), _js_session_from(), _js_session_start(), _js_session_to(), js_deliver(), js_offline_main(), js_server_main(), js_user_create(), js_user_delete(), and jsm_shutdown().

int js_mapi_call2 ( jsmi  si,
event  e,
jpacket  packet,
udata  user,
session  s,
xmlnode  serialization_node 
)

call all the module callbacks for a phase

Only needed for the events es_SERIALIZE and es_DESERIALIZE. Other events can use the shorter interface of js_mapi_call()

Addes callbacks to the ignore mask for a given packet type if they return M_IGNORE.

Parameters:
si the session manager instance data (MUST be NULL for a es_* event)
e call the modules for which event type
packet the packet being processed, may be NULL
user the user data for the current session (or the sender for e_SERVER if it is local), may be NULL
s the session for which to call the event, may be NULL
serialization_node the xmlnode to pass for es_SERIALIZE, and es_DESERIALIZE event
Returns:
1 if the call was handled by a module, 0 if it wasn't handled

References mapi_struct::additional_result, mlist_struct::arg, mlist_struct::c, mapi_struct::e, jsmi_struct::events, session_struct::events, log_debug2, LOGT_EXECFLOW, M_HANDLED, M_IGNORE, mlist_struct::mask, mlist_struct::next, mapi_struct::packet, mapi_struct::s, mapi_struct::serialization_node, mapi_struct::si, session_struct::si, jpacket_struct::type, mapi_struct::user, jpacket_struct::x, xmlnode_free(), and ZONE.

Referenced by js_mapi_call().

void js_mapi_create_additional_iq_result ( mapi  m,
const char *  name,
const char *  prefix,
const char *  ns_iri 
)

create an additiona_result element in the mapi structure

checks if there is already an additional result in the mapi structure, if not, it generates an iq result for the current query in the packet inside the mapi strucutre (needs to by an iq query of type get or set).

If name, prefix, and ns_iri is not NULL, an element in inserted in the iq result having this data.

Parameters:
m the mapi structure
name the local name of the element contained in the iq result
prefix the prefix of the element contained in the iq result
ns_iri the namespace iri of the element contained in the iq result

References mapi_struct::additional_result, jpacket_struct::iq, JPACKET__GET, JPACKET__SET, JPACKET_IQ, jpacket_new(), jpacket_subtype(), jutil_iqresult(), mapi_struct::packet, jpacket_struct::type, jpacket_struct::x, xmlnode_dup(), and xmlnode_insert_tag_ns().

void js_mapi_register ( jsmi  si,
event  e,
mcall  c,
void *  arg 
)

let a module register a new callback for a specified phase

Takes a function pointer and argument and stores them in the callback list for the event e

Parameters:
si the session manager instance data
e the event type for which to register the callback
c pointer to the function, that gets registered
arg an argument to pass to c when it is called

References mlist_struct::arg, mlist_struct::c, e_LAST, jsmi_struct::events, log_debug2, LOGT_INIT, mlist_struct::mask, mlist_struct::next, jsmi_struct::p, pmalloco(), and ZONE.

Referenced by mod_admin(), mod_agents(), mod_announce(), mod_auth_crypt(), mod_auth_digest(), mod_auth_plain(), mod_browse(), mod_disco(), mod_dynamic(), mod_echo(), mod_example(), mod_last(), mod_log(), mod_offline(), mod_ping(), mod_presence(), mod_privacy(), mod_register(), mod_roster(), mod_stat(), mod_time(), mod_useridpolicy(), mod_vcard(), mod_version(), and mod_xml().

void js_mapi_session ( event  e,
session  s,
mcall  c,
void *  arg 
)

let a module register a new callback for a specified phase on a session

This is like js_mapi_register except that the call only applies to the specified session.

Parameters:
e the event type for which to register the callback
s the session for which the callback should be registered
c pointer to the function, that gets registered
arg an argument to pass to c when it is called

References mlist_struct::arg, mlist_struct::c, es_LAST, session_struct::events, log_debug2, LOGT_INIT, mlist_struct::mask, mlist_struct::next, session_struct::p, pmalloco(), and ZONE.


Generated on Wed Sep 10 01:59:48 2008 for jabberd14 by  doxygen 1.5.5