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

void pres_deliver ( sess_t  sess,
pkt_t  pkt 
)

outgoing directed presence

Definition at line 334 of file pres.c.

References sess_st::A, sess_st::E, pkt_PRESENCE, pkt_PRESENCE_UN, pres_trust(), pkt_st::to, pkt_st::type, and sess_st::user.

Referenced by _presence_in_sess().

                                          {

    if(jid_full(pkt->to) == NULL) {
        log_debug(ZONE, "invalid jid in directed presence packet");
        pkt_free(pkt);
        return;
    }

    if(pkt->type == pkt_PRESENCE) {
        /* B7: forward, add to A (unless in T), remove from E */
        log_debug(ZONE, "delivering directed available presence to %s", jid_full(pkt->to));
        if(!pres_trust(sess->user, pkt->to))
            sess->A = jid_append(sess->A, pkt->to);
        sess->E = jid_zap(sess->E, pkt->to);
        pkt_router(pkt);
        return;
    }

    if(pkt->type == pkt_PRESENCE_UN) {
        /* B8: forward, remove from A and E */
        log_debug(ZONE, "delivering directed unavailable presence to %s", jid_full(pkt->to));
        sess->A = jid_zap(sess->A, pkt->to);
        sess->E = jid_zap(sess->E, pkt->to);
        pkt_router(pkt);
        return;
    }

    log_debug(ZONE, "don't know how to deliver presence type %d to %s, dropping", pkt->type, jid_full(pkt->to));

    pkt_free(pkt);
}


Generated by  Doxygen 1.6.0   Back to index