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

void sess_route ( sess_t  sess,
pkt_t  pkt 
)

send a packet to the client for this session

Definition at line 31 of file sess.c.

References sess_st::c2s, sess_st::c2s_id, pkt_st::from, sm_st::id, sess_st::jid, pkt_st::nad, pkt_st::rfrom, sm_st::router, pkt_st::rto, user_st::sm, sess_st::sm_id, pkt_st::to, and sess_st::user.

                                        {
    int ns;

    log_debug(ZONE, "routing pkt 0x%X to %s (%s) for %s", pkt, sess->c2s, sess->c2s_id, jid_full(sess->jid));

    if(pkt == NULL)
        return;

    /* wrap it up */
    ns = nad_append_namespace(pkt->nad, 1, uri_SESSION, "sm");

    nad_set_attr(pkt->nad, 1, ns, "c2s", sess->c2s_id, 0);
    nad_set_attr(pkt->nad, 1, ns, "sm", sess->sm_id, 0);

    nad_set_attr(pkt->nad, 0, -1, "to", sess->c2s, 0);
    nad_set_attr(pkt->nad, 0, -1, "from", sess->user->sm->id, 0);

    /* and send it out */
    sx_nad_write(sess->user->sm->router, pkt->nad);

    /* free up the packet */
    if(pkt->rto != NULL) jid_free(pkt->rto);
    if(pkt->rfrom != NULL) jid_free(pkt->rfrom);
    if(pkt->to != NULL) jid_free(pkt->to);
    if(pkt->from != NULL) jid_free(pkt->from);
    free(pkt);
}


Generated by  Doxygen 1.6.0   Back to index