Changeset f73b969 for irc.c


Ignore:
Timestamp:
2006-01-20T15:15:49Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
54879ab, f1d38f2
Parents:
55ec2d6
Message:

Renamed commands.c, got rid of return values in all command functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc.c

    r55ec2d6 rf73b969  
    152152}
    153153
     154/* immed=1 makes this function pretty much equal to irc_free(), except that
     155   this one will "log". In case the connection is already broken and we
     156   shouldn't try to write to it. */
    154157void irc_abort( irc_t *irc, int immed, char *format, ... )
    155158{
    156         va_list params;
    157        
    158159        if( format != NULL )
    159160        {
     161                va_list params;
    160162                char *reason;
    161163               
    162164                va_start( params, format );
    163                 reason = g_strdup_printf( format, params );
     165                reason = g_strdup_vprintf( format, params );
    164166                va_end( params );
    165167               
     
    168170               
    169171                ipc_to_master_str( "OPERMSG :Client exiting: %s@%s [%s]\r\n",
    170                                    irc->nick, irc->host, reason" );
     172                                   irc->nick ? irc->nick : "(NONE)", irc->host, reason );
    171173               
    172174                g_free( reason );
     
    178180               
    179181                ipc_to_master_str( "OPERMSG :Client exiting: %s@%s [%s]\r\n",
    180                                    irc->nick, irc->host, "No reason given" );
     182                                   irc->nick ? irc->nick : "(NONE)", irc->host, "No reason given" );
    181183        }
    182184       
     
    339341}
    340342
    341 int irc_process( irc_t *irc )
     343void irc_process( irc_t *irc )
    342344{
    343345        char **lines, *temp, **cmd;
     
    361363                        if( ( cmd = irc_parse_line( lines[i] ) ) == NULL )
    362364                                continue;
    363                         if( !irc_exec( irc, cmd ) )
    364                         {
    365                                 g_free( cmd );
    366                                 g_free( lines );
    367                                 return 0;
    368                         }
     365                        irc_exec( irc, cmd );
    369366                       
    370367                        g_free( cmd );
     368                       
     369                        /* Shouldn't really happen, but just in case... */
     370                        if( !g_slist_find( irc_connection_list, irc ) )
     371                        {
     372                                g_free( lines );
     373                                return;
     374                        }
    371375                }
    372376               
     
    379383                g_free( lines );
    380384        }
    381        
    382         return 1;       
    383385}
    384386
     
    972974               
    973975                if( u->send_handler )
    974                         return( u->send_handler( irc, u, s, flags ) );
     976                {
     977                        u->send_handler( irc, u, s, flags );
     978                        return 1;
     979                }
    975980        }
    976981        else if( c && c->gc && c->gc->prpl )
     
    9981003}
    9991004
    1000 int buddy_send_handler( irc_t *irc, user_t *u, char *msg, int flags )
    1001 {
    1002         if( !u || !u->gc ) return( 0 );
     1005void buddy_send_handler( irc_t *irc, user_t *u, char *msg, int flags )
     1006{
     1007        if( !u || !u->gc ) return;
    10031008       
    10041009        if( set_getint( irc, "buddy_sendbuffer" ) && set_getint( irc, "buddy_sendbuffer_delay" ) > 0 )
     
    10361041                        g_source_remove( u->sendbuf_timer );
    10371042                u->sendbuf_timer = g_timeout_add( delay, buddy_send_handler_delayed, u );
    1038                
    1039                 return( 1 );
    10401043        }
    10411044        else
    10421045        {
    1043                 return( serv_send_im( irc, u, msg, flags ) );
     1046                serv_send_im( irc, u, msg, flags );
    10441047        }
    10451048}
     
    11461149        if( rv > 0 )
    11471150        {
    1148                 irc_abort( irc, "ERROR :Closing Link: Ping Timeout: %d seconds", rv );
     1151                irc_abort( irc, 0, "Ping Timeout: %d seconds", rv );
    11491152                return FALSE;
    11501153        }
Note: See TracChangeset for help on using the changeset viewer.