Changeset 1c3008a for dcc.c


Ignore:
Timestamp:
2009-12-13T14:48:56Z (15 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
e8c8d00
Parents:
2288705
Message:

No functional changes, just some style "fixes". Although I admit I'm
somewhat growing out of my own coding style, I do try to keep things
consistent at least within files.

Comments are now in reviewboard:

http://code.bitlbee.org/rb/r/13/

File:
1 edited

Legend:

Unmodified
Added
Removed
  • dcc.c

    r2288705 r1c3008a  
    115115{
    116116        file_transfer_t *file = g_new0( file_transfer_t, 1 );
    117         dcc_file_transfer_t *df = file->priv = g_new0( dcc_file_transfer_t, 1);
     117        dcc_file_transfer_t *df = file->priv = g_new0( dcc_file_transfer_t, 1 );
     118       
    118119        file->file_size = file_size;
    119120        file->file_name = g_strdup( file_name );
     
    144145        /* listen and request */
    145146
    146         if( ( df->fd = ft_listen( &saddr, host, port, TRUE, &errmsg ) ) == -1 ) {
     147        if( ( df->fd = ft_listen( &saddr, host, port, TRUE, &errmsg ) ) == -1 )
     148        {
    147149                dcc_abort( df, "Failed to listen locally, check your ft_listen setting in bitlbee.conf: %s", errmsg );
    148150                return NULL;
     
    161163        df->progress_timeout = b_timeout_add( DCC_MAX_STALL * 1000, dcc_progress, df );
    162164
    163         imcb_log( ic, "File transfer request from %s for %s (%zd kb). ", user_nick, file_name, file_size/1024 );
    164 
    165         imcb_log( ic, "Accept the file transfer if you'd like the file. If you don't, issue the 'transfers reject' command.");
     165        imcb_log( ic, "File transfer request from %s for %s (%zd kb).\n"
     166                      "Accept the file transfer if you'd like the file. If you don't, "
     167                      "issue the 'transfers reject' command.",
     168                      user_nick, file_name, file_size / 1024 );
    166169
    167170        return file;
     
    199202                /* no progress. cancel */
    200203                if( df->bytes_sent == 0 )
    201                         return dcc_abort( df, "Couldnt establish transfer within %d seconds", DCC_MAX_STALL );
     204                        return dcc_abort( df, "Couldn't establish transfer within %d seconds", DCC_MAX_STALL );
    202205                else
    203206                        return dcc_abort( df, "Transfer stalled for %d seconds at %d kb", DCC_MAX_STALL, df->bytes_sent / 1024 );
     
    230233                         ntohl( saddr_ipv4->sin_addr.s_addr ) );
    231234                port = saddr_ipv4->sin_port;
    232         } else
     235        }
     236        else
    233237        {
    234238                struct sockaddr_in6 *saddr_ipv6 = ( struct sockaddr_in6 *) saddr;
     
    250254       
    251255        if ( !irc_msgfrom( df->ic->irc, user_nick, cmd ) )
    252                 return dcc_abort( df, "couldn't send 'DCC SEND' message to %s", user_nick );
     256                return dcc_abort( df, "Couldn't send `DCC SEND' message to %s.", user_nick );
    253257
    254258        g_free( cmd );
     
    313317        short revents;
    314318       
    315         if( !dcc_poll( df, fd, &revents) )
     319        if( !dcc_poll( df, fd, &revents ) )
    316320                return FALSE;
    317321
     
    349353                int ret;
    350354               
    351                 ASSERTSOCKOP( ret = recv( fd, &bytes_received, sizeof( bytes_received  ), MSG_PEEK ), "Receiving" );
     355                ASSERTSOCKOP( ret = recv( fd, &bytes_received, sizeof( bytes_received ), MSG_PEEK ), "Receiving" );
    352356
    353357                if( ret == 0 )
     
    356360                if( ret < 4 )
    357361                {
    358                         imcb_log( df->ic, "WARNING: DCC SEND: receiver sent only 2 bytes instead of 4, shouldn't happen too often!" );
     362                        imcb_log( df->ic, "WARNING: DCC SEND: receiver sent only %d bytes instead of 4, shouldn't happen too often!", ret );
    359363                        return TRUE;
    360364                }
    361365
    362                 ASSERTSOCKOP( ret = recv( fd, &bytes_received, sizeof( bytes_received  ), 0 ), "Receiving" );
     366                ASSERTSOCKOP( ret = recv( fd, &bytes_received, sizeof( bytes_received ), 0 ), "Receiving" );
    363367                if( ret != 4 )
    364368                        return dcc_abort( df, "MSG_PEEK'ed 4, but can only dequeue %d bytes", ret );
     
    400404                return dcc_abort( df, "BUG: protocol didn't register write()" );
    401405       
    402         ASSERTSOCKOP( fd = df->fd = socket( saddr->ss_family, SOCK_STREAM, 0 ) , "Opening Socket" );
     406        ASSERTSOCKOP( fd = df->fd = socket( saddr->ss_family, SOCK_STREAM, 0 ), "Opening Socket" );
    403407
    404408        sock_make_nonblocking( fd );
     
    429433}
    430434
    431 gboolean dccs_recv_proto( gpointer data, gint fd, b_input_condition cond)
     435gboolean dccs_recv_proto( gpointer data, gint fd, b_input_condition cond )
    432436{
    433437        dcc_file_transfer_t *df = data;
Note: See TracChangeset for help on using the changeset viewer.