Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/iq.c

    r4306d8b r2ff2076  
    3131{
    3232        struct im_connection *ic = data;
     33        struct jabber_data *jd = ic->proto_data;
    3334        struct xt_node *c, *reply = NULL;
    3435        char *type, *s;
     
    4647        if( strcmp( type, "result" ) == 0 || strcmp( type, "error" ) == 0 )
    4748        {
    48                 return jabber_cache_handle_packet( ic, node );
     49                struct jabber_cache_entry *entry;
     50               
     51                if( ( s = xt_find_attr( node, "id" ) ) == NULL ||
     52                    strncmp( s, jd->cached_id_prefix, strlen( jd->cached_id_prefix ) ) != 0 )
     53                {
     54                        /* Silently ignore it, without an ID (or a non-cache
     55                           ID) we don't know how to handle the packet and we
     56                           probably don't have to. */
     57                        return XT_HANDLED;
     58                }
     59               
     60                entry = g_hash_table_lookup( jd->node_cache, s );
     61               
     62                if( entry == NULL )
     63                        imcb_log( ic, "WARNING: Received IQ-%s packet with unknown/expired ID %s!", type, s );
     64                else if( entry->func )
     65                        return entry->func( ic, node, entry->node );
    4966        }
    5067        else if( strcmp( type, "get" ) == 0 )
     
    87104                                                   XMLNS_CHATSTATES,
    88105                                                   XMLNS_MUC,
     106                                                   XMLNS_SI,
     107                                                   XMLNS_BYTESTREAMS,
     108                                                   XMLNS_FILETRANSFER,
    89109                                                   NULL };
    90110                        const char **f;
     
    106126                {
    107127                        xt_free_node( reply );
    108                         reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel" );
     128                        reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel", NULL );
    109129                        pack = 0;
    110130                }
     
    112132        else if( strcmp( type, "set" ) == 0 )
    113133        {
    114                 if( !( c = xt_find_node( node->children, "query" ) ) ||
     134                if(  ( c = xt_find_node( node->children, "si" ) ) &&
     135                     ( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_SI ) == 0 ) )
     136                {
     137                        return jabber_si_handle_request( ic, node, c );
     138                } else if( !( c = xt_find_node( node->children, "query" ) ) ||
    115139                    !( s = xt_find_attr( c, "xmlns" ) ) )
    116140                {
    117141                        imcb_log( ic, "WARNING: Received incomplete IQ-%s packet", type );
    118142                        return XT_HANDLED;
    119                 }
    120                
     143                } else if( strcmp( s, XMLNS_ROSTER ) == 0 )
     144                {
    121145                /* This is a roster push. XMPP servers send this when someone
    122146                   was added to (or removed from) the buddy list. AFAIK they're
    123147                   sent even if we added this buddy in our own session. */
    124                 if( strcmp( s, XMLNS_ROSTER ) == 0 )
    125                 {
    126148                        int bare_len = strlen( ic->acc->user );
    127149                       
     
    140162                               
    141163                                xt_free_node( reply );
    142                                 reply = jabber_make_error_packet( node, "not-allowed", "cancel" );
     164                                reply = jabber_make_error_packet( node, "not-allowed", "cancel", NULL );
    143165                                pack = 0;
    144166                        }
    145                 }
    146                 else
     167                } else if( strcmp( s, XMLNS_BYTESTREAMS ) == 0 )
     168                {
     169                        /* Bytestream Request (stage 2 of file transfer) */
     170                        return jabber_bs_recv_request( ic, node, c );
     171                } else
    147172                {
    148173                        xt_free_node( reply );
    149                         reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel" );
     174                        reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel", NULL );
    150175                        pack = 0;
    151176                }
Note: See TracChangeset for help on using the changeset viewer.