Ignore:
Timestamp:
2006-10-12T17:48:58Z (16 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
a4effbf
Parents:
b56b220
Message:

Special message when the XMPP session is ended because of a concurrent
login, and now sending proper error responses to IQ packets we can't
handle.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber_util.c

    rb56b220 r259edd4  
    7979}
    8080
    81 /* Cache a node/packet for later use. Mainly useful for IQ packets if you need
     81struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type )
     82{
     83        struct xt_node *node, *c;
     84        char *to;
     85       
     86        /* Create the "defined-condition" tag. */
     87        c = xt_new_node( err_cond, NULL, NULL );
     88        xt_add_attr( c, "xmlns", "urn:ietf:params:xml:ns:xmpp-stanzas" );
     89       
     90        /* Put it in an <error> tag. */
     91        c = xt_new_node( "error", NULL, c );
     92        xt_add_attr( c, "type", err_type );
     93       
     94        /* To make the actual error packet, we copy the original packet and
     95           add our <error>/type="error" tag. Including the original packet
     96           is recommended, so let's just do it. */
     97        node = xt_dup( orig );
     98        xt_add_child( node, c );
     99        xt_add_attr( node, "type", "error" );
     100       
     101        /* Return to sender. */
     102        if( ( to = xt_find_attr( node, "from" ) ) )
     103        {
     104                xt_add_attr( node, "to", to );
     105                xt_remove_attr( node, "from" );
     106        }
     107               
     108        return node;
     109}
     110
     111/* Cache a node/epacket for later use. Mainly useful for IQ packets if you need
    82112   them when you receive the response. Use this BEFORE sending the packet so
    83113   it'll get an id= tag, and do NOT free() the packet after writing it! */
Note: See TracChangeset for help on using the changeset viewer.