Changeset 4ac647d for protocols


Ignore:
Timestamp:
2008-08-04T14:21:49Z (16 years ago)
Author:
ulim <a.sporto+bee@…>
Branches:
master
Children:
8661caa
Parents:
8a90001
Message:

moved some stuff around in preperation for MSN merge.

  • both ends (proto&dcc) need to finish a transfer now for it to be finished
  • moved throughput calc. and some messages to dcc (no need to implement in protocols)
Location:
protocols
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • protocols/ft.h

    r8a90001 r4ac647d  
    171171
    172172gboolean imcb_file_recv_start( file_transfer_t *ft );
     173
     174void imcb_file_finished( file_transfer_t *file );
    173175#endif
  • protocols/jabber/jabber.c

    r8a90001 r4ac647d  
    245245        struct jabber_data *jd = ic->proto_data;
    246246       
     247        while( jd->filetransfers )
     248                imcb_file_canceled( ( ( struct jabber_transfer *) jd->filetransfers->data )->ft, "Logging out" );
     249
     250        while( jd->streamhosts )
     251        {
     252                jabber_streamhost_t *sh = jd->streamhosts->data;
     253                jd->streamhosts = g_slist_remove( jd->streamhosts, sh );
     254                g_free( sh->jid );
     255                g_free( sh->host );
     256                g_free( sh );
     257        }
     258
    247259        if( jd->fd >= 0 )
    248260                jabber_end_stream( ic );
  • protocols/jabber/s5bytestream.c

    r8a90001 r4ac647d  
    643643                return jabber_bs_abort( bt, "Remote end closed connection" );
    644644       
    645         if( tf->bytesread == 0 )
    646                 tf->ft->started = time( NULL );
    647 
    648645        tf->bytesread += ret;
     646
     647        if( tf->bytesread >= tf->ft->file_size )
     648                imcb_file_finished( tf->ft );
    649649
    650650        tf->ft->write( tf->ft, tf->ft->buffer, ret );   
     
    701701        ASSERTSOCKOP( ret = send( tf->fd, buffer, len, 0 ), "Sending" );
    702702
    703         if( tf->byteswritten == 0 )
    704                 tf->ft->started = time( NULL );
    705 
    706703        tf->byteswritten += ret;
    707704       
     
    710707                return jabber_bs_abort( bt, "send() sent %d instead of %d (send buffer too big!)", ret, len );
    711708
    712         bt->tf->watch_out = b_input_add( tf->fd, GAIM_INPUT_WRITE, jabber_bs_send_can_write, bt );
     709        if( tf->byteswritten >= ft->file_size )
     710                imcb_file_finished( ft );
     711        else
     712                bt->tf->watch_out = b_input_add( tf->fd, GAIM_INPUT_WRITE, jabber_bs_send_can_write, bt );
    713713               
    714714        return TRUE;
  • protocols/jabber/si.c

    r8a90001 r4ac647d  
    5454}
    5555
    56 /* file_transfer finished() callback */
    57 void jabber_si_finished( file_transfer_t *ft )
    58 {
    59         struct jabber_transfer *tf = ft->data;
    60         time_t diff = time( NULL ) - ft->started ? : 1;
    61 
    62         imcb_log( tf->ic, "File %s transferred successfully at %d kb/s!" , ft->file_name, (int) ( ft->bytes_transferred / 1024 / diff ) );
    63 }
    64 
    6556/* file_transfer canceled() callback */
    6657void jabber_si_canceled( file_transfer_t *ft, char *reason )
     
    177168        tf->ft->data = tf;
    178169        tf->ft->free = jabber_si_free_transfer;
    179         tf->ft->finished = jabber_si_finished;
    180170        tf->bud = bud;
    181171        ft->write = jabber_bs_send_write;
     
    302292        /* Request is fine. */
    303293
    304         imcb_log( ic, "File transfer request from %s for %s (%zd kb). ", xt_find_attr( node, "from" ), name, size/1024 );
    305 
    306         imcb_log( ic, "Accept the file transfer if you'd like the file. If you don't, issue the 'transfers reject' command.");
    307 
    308294        tf = g_new0( struct jabber_transfer, 1 );
    309295
     
    318304        tf->ft->accept = jabber_si_answer_request;
    319305        tf->ft->free = jabber_si_free_transfer;
    320         tf->ft->finished = jabber_si_finished;
    321306        tf->ft->canceled = jabber_si_canceled;
    322307
Note: See TracChangeset for help on using the changeset viewer.