Ignore:
Timestamp:
2007-12-04T00:48:57Z (14 years ago)
Author:
ulim <a.sporto+bee@…>
Branches:
master
Children:
8076ec0, fa30fa5
Parents:
2ff2076
Message:

Send and receive seems to work now! Also adopted the new buffering strategy,
only one buffer of 2k per transfer now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/si.c

    r2ff2076 rdce3903  
    8484        struct jabber_data *jd = ic->proto_data;
    8585
    86         imcb_log( ic, "Incoming file from %s : %s %zd bytes", ic->irc->nick, ft->file_name, ft->file_size );
     86        imcb_log( ic, "Trying to send %s(%zd bytes) to %s", ft->file_name, ft->file_size, who );
    8787
    8888        tf = g_new0( struct jabber_transfer, 1 );
     
    224224
    225225/*
    226  * imcb called the accept callback which probably means that the user accepted this file transfer.
     226 * imc called the accept callback which probably means that the user accepted this file transfer.
    227227 * We send our response to the initiator.
    228228 * In the next step, the initiator will send us a request for the given stream type.
     
    275275{
    276276        struct xt_node *c, *d;
    277         char *ini_jid, *tgt_jid;
     277        char *ini_jid, *tgt_jid, *iq_id;
    278278        GSList *tflist;
    279279        struct jabber_transfer *tf=NULL;
    280280        struct jabber_data *jd = ic->proto_data;
    281         char *sid;
    282281
    283282        if( !( tgt_jid = xt_find_attr( node, "from" ) ) ||
     
    288287        }
    289288       
    290         imcb_log( ic, "GOT RESPONSE TO FILE" );
    291289        /* All this means we expect something like this: ( I think )
    292          * <iq from=... to=...>
     290         * <iq from=... to=... id=...>
    293291         *      <si xmlns=si>
    294          *              <file xmlns=ft/>
     292         *      [       <file xmlns=ft/>    ] <-- not neccessary
    295293         *              <feature xmlns=feature>
    296294         *                      <x xmlns=xdata type=submit>
     
    300298        if( !( tgt_jid = xt_find_attr( node, "from" ) ) ||
    301299            !( ini_jid = xt_find_attr( node, "to" ) ) ||
     300            !( iq_id   = xt_find_attr( node, "id" ) ) ||
    302301            !( c = xt_find_node( node->children, "si" ) ) ||
    303302            !( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_SI ) == 0 ) ||
    304             !( sid = xt_find_attr( c, "id" ) )||
    305             !( d = xt_find_node( c->children, "file" ) ) ||
    306             !( strcmp( xt_find_attr( d, "xmlns" ), XMLNS_FILETRANSFER ) == 0 ) ||
     303/*          !( d = xt_find_node( c->children, "file" ) ) ||
     304            !( strcmp( xt_find_attr( d, "xmlns" ), XMLNS_FILETRANSFER ) == 0 ) || */
    307305            !( d = xt_find_node( c->children, "feature" ) ) ||
    308306            !( strcmp( xt_find_attr( d, "xmlns" ), XMLNS_FEATURE ) == 0 ) ||
     
    331329        {
    332330                struct jabber_transfer *tft = tflist->data;
    333                 if( ( strcmp( tft->sid, sid ) == 0 ) )
     331                if( ( strcmp( tft->iq_id, iq_id ) == 0 ) )
    334332                {
    335333                        tf = tft;
     
    346344        tf->ini_jid = g_strdup( ini_jid );
    347345        tf->tgt_jid = g_strdup( tgt_jid );
     346
     347        imcb_log( ic, "File %s: %s accepted the transfer!", tf->ft->file_name, tgt_jid );
    348348
    349349        jabber_bs_send_start( tf );
     
    423423        node = jabber_make_packet( "iq", "set", bud ? bud->full_jid : who, sinode );
    424424        jabber_cache_add( ic, node, jabber_si_handle_response );
     425        tf->iq_id = g_strdup( xt_find_attr( node, "id" ) );
    425426       
    426427        return jabber_write_packet( ic, node );
Note: See TracChangeset for help on using the changeset viewer.