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

void pres_roster ( sess_t  sess,
item_t  item 
)

send presence based on roster changes

Definition at line 383 of file pres.c.

References sess_st::A, sess_st::available, sess_st::E, item_st::from, sess_st::invisible, sess_st::jid, item_st::jid, pkt_dup(), sess_st::pres, user_st::sm, and sess_st::user.

Referenced by _roster_pkt_user().

                                           {
    /* if we're not available, then forget it */
    if(!sess->available)
        return;
    
    /* if they were trusted previously, but aren't anymore, and we haven't
     * explicitly sent them presence, then make them forget */
    if(!item->from && !jid_search(sess->A, item->jid) && !jid_search(sess->E, item->jid)) {
        log_debug(ZONE, "forcing unavailable to %s after roster change", jid_full(item->jid));
        pkt_router(pkt_create(sess->user->sm, "presence", "unavailable", jid_full(item->jid), jid_full(sess->jid)));
        return;
    }

    /* if they're now trusted, and we're not invisible, and we haven't sent
     * them directed presence, then they get to see us for the first time */
    if(item->from && !sess->invisible && !jid_search(sess->A, item->jid) && !jid_search(sess->E, item->jid)) {
        log_debug(ZONE, "forcing available to %s after roster change", jid_full(item->jid));
        pkt_router(pkt_dup(sess->pres, jid_full(item->jid), jid_full(sess->jid)));
    }
}


Generated by  Doxygen 1.6.0   Back to index