Logo Search packages:      
Sourcecode: jabberd14 version File versions  Download package

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.

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
1 if the call was handled by a module, 0 if it wasn't handled

Definition at line 195 of file modules.cc.

References _js_mapi_process_additional_result(), mapi_struct::additional_result, mlist_struct::arg, mlist_struct::c, mapi_struct::e, jsmi_struct::events, session_struct::events, 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, mapi_struct::user, and xmlnode_free().

Referenced by _jsm_deserialize_session(), and js_mapi_call().

    mlist l;
    _mapi m;            /* mapi structure to be passed to the call back */

    log_debug2(ZONE, LOGT_EXECFLOW, "mapi_call %d",e);

    /* this is a session event */
    if(si == NULL && s != NULL) {
        si = s->si;
        l = s->events[e];
    } else {
        l = si->events[e];

    /* fill in the mapi structure */
    m.si = si;
    m.e = e;
    m.packet = packet;
    m.user = user;
    m.s = s;
    m.serialization_node = serialization_node;
    m.additional_result = NULL;

    /* traverse the list of call backs */
    for (;l != NULL; l = l->next) {
        /* skip call-back if the packet type mask matches */
        if(packet != NULL && (packet->type & l->mask) == packet->type)
      log_debug2(ZONE, LOGT_EXECFLOW, "MAPI %X",l);
        /* call the function and handle the result */
        switch((*(l->c))(&m, l->arg)) {
          /* this module is ignoring this packet->type */
          case M_IGNORE:
            /* add the packet type to the mask */
            l->mask |= packet->type;
          /* this module handled the packet */
          case M_HANDLED:
            return 1;

    log_debug2(ZONE, LOGT_EXECFLOW, "mapi_call returning unhandled");

    /* did the modules generate a co-generated result? */
    if (_js_mapi_process_additional_result(&m)) {
      return 1;

    /* if we got here, no module handled the packet */
    return 0;

Generated by  Doxygen 1.6.0   Back to index