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

void js_deliver ( jsmi  si,
jpacket  p,
session  sending_s 

take a packet and deliver it either locally if it has ourself as the destination or deliver it using jabberd if it is for a non-instance-local host

This function checks if the packet is local, and will then call j_deliver_local() to deliver it. If it is not instance-local it will call deliver() to deliver it using jabberd.

any jpacket sent to deliver *MUST* match jpacket_new(p->x), jpacket is simply a convenience wrapper
si the session manager instance this is called in
p the packet to deliver
sending_s the sending session of the packet (used to select the correct outgoing filter), NULL if packet is not related to a session

Definition at line 543 of file deliver.cc.

References deliver(), dpacket_new(), e_FILTER_OUT, es_FILTER_OUT, jsmi_struct::hosts, jsmi_struct::i, js_bounce_xmpp(), js_deliver_local(), js_mapi_call(), js_user(), log_warn(), PACKET_PASS_FILTERS_MAGIC, session_struct::u, xhash_get(), xmlnode_free(), and xmlnode_serialize_string().

Referenced by _js_mapi_process_additional_result(), _js_session_from(), _js_session_to(), _mod_admin_disco_online_info(), _mod_admin_disco_online_items(), _mod_browse_server(), _mod_last_server_last(), _mod_presence_broadcast(), _mod_register_server_register(), _mod_time_reply(), _mod_version_reply(), js_bounce_xmpp(), js_deliver_local(), mod_admin_message(), mod_agents_agent(), mod_agents_agents(), mod_browse_reply(), mod_disco_server_items(), mod_disco_user_info(), mod_disco_user_items(), mod_echo_reply(), mod_example_server(), mod_last_reply(), mod_offline_message(), mod_ping_out(), mod_ping_server_ping(), mod_presence_in(), mod_privacy_activate_list(), mod_privacy_no_active_list(), mod_register_new(), mod_roster_delete(), mod_roster_s10n(), mod_vcard_jud(), mod_vcard_reply(), and mod_vcard_server().

    xht ht;       /* hashtable containing the users of the relevant host */

    /* does it have a destination address? */
    if (p->to == NULL) {
        log_warn(NULL, "jsm: Invalid Recipient, returning data %s", xmlnode_serialize_string(p->x, xmppd::ns_decl_list(), 0));
        js_bounce_xmpp(si, sending_s, p->x, XTERROR_BAD);

    /* does it have a sender address? */
    if (p->from == NULL) {
        log_warn(NULL, "jsm: Invalid Sender, discarding data %s", xmlnode_serialize_string(p->x, xmppd::ns_decl_list(), 0));

    /* do we have to pass it through the outgoing filters? */

    /* only filter if packet is from a user, and if the packet is not to the user himself */
    if (p->flag != PACKET_PASS_FILTERS_MAGIC && p->from->user != NULL && jid_cmpx(p->to, p->from, JID_USER|JID_SERVER) != 0) {
      /* filter through a session's filter? */
      if (sending_s != NULL) {
          if (js_mapi_call(NULL, es_FILTER_OUT, p, sending_s->u, sending_s)) {
            return; /* blocked by a filter module */
      } else {
          /* sending through offline filter */
          udata sending_user = js_user(si, p->from, NULL);

          if (js_mapi_call(si, e_FILTER_OUT, p, sending_user, NULL)) {
            return; /* blocked by a filter module */

    log_debug2(ZONE, LOGT_DELIVER, "deliver(to[%s],from[%s],type[%d],packet[%s])", jid_full(p->to), jid_full(p->from), p->type, xmlnode_serialize_string(p->x, xmppd::ns_decl_list(), 0));

    /* external or local delivery? */
    if ((ht = (xht)xhash_get(si->hosts,p->to->server)) != NULL) {
        js_deliver_local(si, p, ht);
    deliver(dpacket_new(p->x), si->i);

Generated by  Doxygen 1.6.0   Back to index