Changeset ba9edaa


Ignore:
Timestamp:
2006-05-10T17:34:46Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
13cc96c
Parents:
67b6766
Message:

Moved everything to the BitlBee event handling API.

Files:
25 edited

Legend:

Unmodified
Added
Removed
  • bitlbee.c

    r67b6766 rba9edaa  
    3434#include <errno.h>
    3535
    36 void bitlbee_io_new_client( gpointer data, gint source, GaimInputCondition condition );
     36static gboolean bitlbee_io_new_client( gpointer data, gint source, b_input_condition condition );
    3737
    3838int bitlbee_daemon_init()
     
    9090        }
    9191       
    92         global.listen_watch_source_id = gaim_input_add( global.listen_socket, GAIM_INPUT_READ, bitlbee_io_new_client, NULL );
     92        global.listen_watch_source_id = b_input_add( global.listen_socket, GAIM_INPUT_READ, bitlbee_io_new_client, NULL );
    9393       
    9494#ifndef _WIN32
     
    145145}
    146146
    147 void bitlbee_io_current_client_read( gpointer data, gint source, GaimInputCondition cond )
     147gboolean bitlbee_io_current_client_read( gpointer data, gint source, b_input_condition cond )
    148148{
    149149        irc_t *irc = data;
     
    155155        {
    156156                irc_abort( irc, 1, "Connection reset by peer" );
    157                 goto no_more_events;
     157                return FALSE;
    158158        }
    159159        else if( st < 0 )
     
    161161                if( sockerr_again() )
    162162                {
    163                         return;
     163                        return TRUE;
    164164                }
    165165                else
    166166                {
    167167                        irc_abort( irc, 1, "Read error: %s", strerror( errno ) );
    168                         goto no_more_events;
     168                        return FALSE;
    169169                }
    170170        }
     
    187187        {
    188188                log_message( LOGLVL_WARNING, "Abnormal termination of connection with fd %d.", irc->fd );
    189                 goto no_more_events;
     189                return FALSE;
    190190        }
    191191       
     
    194194        {
    195195                irc_abort( irc, 0, "Maximum line length exceeded" );
    196                 goto no_more_events;
    197         }
    198        
    199         return;
    200        
    201 no_more_events:
    202         gaim_input_remove( irc->r_watch_source_id );
    203         irc->r_watch_source_id = 0;
    204 }
    205 
    206 void bitlbee_io_current_client_write( gpointer data, gint source, GaimInputCondition cond )
     196                return FALSE;
     197        }
     198       
     199        return TRUE;
     200}
     201
     202gboolean bitlbee_io_current_client_write( gpointer data, gint source, b_input_condition cond )
    207203{
    208204        irc_t *irc = data;
     
    211207
    212208        if( irc->sendbuffer == NULL )
    213                 goto no_more_events;
     209                return FALSE;
    214210       
    215211        size = strlen( irc->sendbuffer );
     
    219215        {
    220216                irc_abort( irc, 1, "Write error: %s", strerror( errno ) );
    221                 goto no_more_events;
     217                return FALSE;
    222218        }
    223219        else if( st < 0 ) /* && sockerr_again() */
    224220        {
    225                 return;
     221                return TRUE;
    226222        }
    227223       
     
    230226                g_free( irc->sendbuffer );
    231227                irc->sendbuffer = NULL;
     228                irc->w_watch_source_id = 0;
    232229               
    233230                if( irc->status == USTATUS_SHUTDOWN )
    234231                        irc_free( irc );
    235232               
    236                 goto no_more_events;
     233                return FALSE;
    237234        }
    238235        else
     
    242239                irc->sendbuffer = temp;
    243240               
    244                 return;
    245         }
    246        
    247 no_more_events:
    248         gaim_input_remove( irc->w_watch_source_id );
    249         irc->w_watch_source_id = 0;
    250 }
    251 
    252 void bitlbee_io_new_client( gpointer data, gint source, GaimInputCondition condition )
     241                return TRUE;
     242        }
     243}
     244
     245static gboolean bitlbee_io_new_client( gpointer data, gint source, b_input_condition condition )
    253246{
    254247        socklen_t size = sizeof( struct sockaddr_in );
     
    260253        {
    261254                log_message( LOGLVL_WARNING, "Could not accept new connection: %s", strerror( errno ) );
    262                 return;
     255                return TRUE;
    263256        }
    264257       
     
    285278                        child->pid = client_pid;
    286279                        child->ipc_fd = fds[0];
    287                         child->ipc_inpa = gaim_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
     280                        child->ipc_inpa = b_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
    288281                        child_list = g_slist_append( child_list, child );
    289282                       
     
    300293                        /* Close the listening socket, we're a client. */
    301294                        close( global.listen_socket );
    302                         g_source_remove( global.listen_watch_source_id );
     295                        b_event_remove( global.listen_watch_source_id );
    303296                       
    304297                        /* Make the connection. */
     
    307300                        /* We can store the IPC fd there now. */
    308301                        global.listen_socket = fds[1];
    309                         global.listen_watch_source_id = gaim_input_add( fds[1], GAIM_INPUT_READ, ipc_child_read, irc );
     302                        global.listen_watch_source_id = b_input_add( fds[1], GAIM_INPUT_READ, ipc_child_read, irc );
    310303                       
    311304                        close( fds[0] );
     
    319312                irc_new( new_socket );
    320313        }
    321 }
    322 
    323 void bitlbee_shutdown( gpointer data )
     314       
     315        return TRUE;
     316}
     317
     318gboolean bitlbee_shutdown( gpointer data, gint fd, b_input_condition cond )
    324319{
    325320        /* Try to save data for all active connections (if desired). */
     
    328323       
    329324        /* We'll only reach this point when not running in inetd mode: */
    330         g_main_quit( global.loop );
    331 }
     325        b_main_quit();
     326       
     327        return FALSE;
     328}
  • bitlbee.h

    r67b6766 rba9edaa  
    8282#undef g_timeout_add_full
    8383#define g_timeout_add_full      __PLEASE_USE_B_TIMEOUT_ADD__
     84#undef g_io_add_watch
     85#define g_io_add_watch          __PLEASE_USE_B_INPUT_ADD__
     86#undef g_io_add_watch_full
     87#define g_io_add_watch_full     __PLEASE_USE_B_INPUT_ADD__
    8488#undef g_source_remove
    85 #define g_source_remove         __PLEASE_USE_B_SOURCE_REMOVE__
     89#define g_source_remove         __PLEASE_USE_B_EVENT_REMOVE__
    8690#undef g_source_remove_by_user_data
    8791#define g_source_remove_by_user_data    __PLEASE_USE_B_SOURCE_REMOVE_BY_USER_DATA__
     
    137141        GList *storage; /* The first backend in the list will be used for saving */
    138142        char *helpfile;
    139         GMainLoop *loop;
    140143        int restart;
    141144} global_t;
     
    144147int bitlbee_inetd_init( void );
    145148
    146 void bitlbee_io_current_client_read( gpointer data, gint source, GaimInputCondition cond );
    147 void bitlbee_io_current_client_write( gpointer data, gint source, GaimInputCondition cond );
     149gboolean bitlbee_io_current_client_read( gpointer data, gint source, b_input_condition cond );
     150gboolean bitlbee_io_current_client_write( gpointer data, gint source, b_input_condition cond );
    148151
    149152void root_command_string( irc_t *irc, user_t *u, char *command, int flags );
    150153void root_command( irc_t *irc, char *command[] );
    151 void bitlbee_shutdown( gpointer data );
     154gboolean bitlbee_shutdown( gpointer data, gint fd, b_input_condition cond );
    152155
    153156extern global_t global;
  • ipc.c

    r67b6766 rba9edaa  
    6060                ipc_to_children_str( "DIE\r\n" );
    6161       
    62         bitlbee_shutdown( NULL );
     62        bitlbee_shutdown( NULL, -1, 0 );
    6363}
    6464
     
    9191       
    9292        global.restart = -1;
    93         bitlbee_shutdown( NULL );
     93        bitlbee_shutdown( NULL, -1, 0 );
    9494}
    9595
     
    246246}
    247247
    248 void ipc_master_read( gpointer data, gint source, GaimInputCondition cond )
     248gboolean ipc_master_read( gpointer data, gint source, b_input_condition cond )
    249249{
    250250        char *buf, **cmd;
     
    272272                }
    273273        }
    274 }
    275 
    276 void ipc_child_read( gpointer data, gint source, GaimInputCondition cond )
     274       
     275        return TRUE;
     276}
     277
     278gboolean ipc_child_read( gpointer data, gint source, b_input_condition cond )
    277279{
    278280        char *buf, **cmd;
     
    286288        else
    287289        {
    288                 gaim_input_remove( global.listen_watch_source_id );
     290                b_event_remove( global.listen_watch_source_id );
    289291                close( global.listen_socket );
    290292               
    291293                global.listen_socket = -1;
    292294        }
     295       
     296        return TRUE;
    293297}
    294298
     
    397401void ipc_master_free_one( struct bitlbee_child *c )
    398402{
    399         gaim_input_remove( c->ipc_inpa );
     403        b_event_remove( c->ipc_inpa );
    400404        closesocket( c->ipc_fd );
    401405       
     
    463467
    464468
    465 static void new_ipc_client( gpointer data, gint serversock, GaimInputCondition cond )
     469static gboolean new_ipc_client( gpointer data, gint serversock, b_input_condition cond )
    466470{
    467471        struct bitlbee_child *child = g_new0( struct bitlbee_child, 1 );
     
    472476        {
    473477                log_message( LOGLVL_WARNING, "Unable to accept connection on UNIX domain socket: %s", strerror(errno) );
    474                 return;
    475         }
    476                
    477         child->ipc_inpa = gaim_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
     478                return TRUE;
     479        }
     480               
     481        child->ipc_inpa = b_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
    478482       
    479483        child_list = g_slist_append( child_list, child );
     484       
     485        return TRUE;
    480486}
    481487
     
    512518        }
    513519       
    514         gaim_input_add( serversock, GAIM_INPUT_READ, new_ipc_client, NULL );
     520        b_input_add( serversock, GAIM_INPUT_READ, new_ipc_client, NULL );
    515521       
    516522        return 1;
     
    552558                        return 0;
    553559                }
    554                 child->ipc_inpa = gaim_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
     560                child->ipc_inpa = b_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
    555561               
    556562                child_list = g_slist_append( child_list, child );
  • ipc.h

    r67b6766 rba9edaa  
    4040
    4141
    42 void ipc_master_read( gpointer data, gint source, GaimInputCondition cond );
    43 void ipc_child_read( gpointer data, gint source, GaimInputCondition cond );
     42gboolean ipc_master_read( gpointer data, gint source, b_input_condition cond );
     43gboolean ipc_child_read( gpointer data, gint source, b_input_condition cond );
    4444
    4545void ipc_master_free_one( struct bitlbee_child *child );
  • irc.c

    r67b6766 rba9edaa  
    2929#include "ipc.h"
    3030
    31 static gboolean irc_userping( gpointer _irc );
     31static gboolean irc_userping( gpointer _irc, int fd, b_input_condition cond );
    3232
    3333GSList *irc_connection_list = NULL;
     
    5656        sock_make_nonblocking( irc->fd );
    5757       
    58         irc->r_watch_source_id = gaim_input_add( irc->fd, GAIM_INPUT_READ, bitlbee_io_current_client_read, irc );
     58        irc->r_watch_source_id = b_input_add( irc->fd, GAIM_INPUT_READ, bitlbee_io_current_client_read, irc );
    5959       
    6060        irc->status = USTATUS_OFFLINE;
     
    114114
    115115        if( global.conf->ping_interval > 0 && global.conf->ping_timeout > 0 )
    116                 irc->ping_source_id = g_timeout_add( global.conf->ping_interval * 1000, irc_userping, irc );
     116                irc->ping_source_id = b_timeout_add( global.conf->ping_interval * 1000, irc_userping, irc );
    117117       
    118118        irc_write( irc, ":%s NOTICE AUTH :%s", irc->myhost, "BitlBee-IRCd initialized, please go on" );
     
    184184                   bitlbee_.._write doesn't do it first. */
    185185               
    186                 g_source_remove( irc->r_watch_source_id );
    187                 irc->r_watch_source_id = g_timeout_add_full( G_PRIORITY_HIGH, 1000, (GSourceFunc) irc_free, irc, NULL );
     186                b_event_remove( irc->r_watch_source_id );
     187                irc->r_watch_source_id = b_timeout_add( 1000, (b_event_handler) irc_free, irc );
    188188        }
    189189        else
     
    218218       
    219219        if( irc->ping_source_id > 0 )
    220                 g_source_remove( irc->ping_source_id );
    221         g_source_remove( irc->r_watch_source_id );
     220                b_event_remove( irc->ping_source_id );
     221        b_event_remove( irc->r_watch_source_id );
    222222        if( irc->w_watch_source_id > 0 )
    223                 g_source_remove( irc->w_watch_source_id );
     223                b_event_remove( irc->w_watch_source_id );
    224224       
    225225        irc_connection_list = g_slist_remove( irc_connection_list, irc );
     
    272272                        if(user->host!=user->nick) g_free(user->host);
    273273                        if(user->realname!=user->nick) g_free(user->realname);
    274                         gaim_input_remove(user->sendbuf_timer);
     274                        b_event_remove(user->sendbuf_timer);
    275275                                       
    276276                        usertmp = user;
     
    322322       
    323323        if( global.conf->runmode == RUNMODE_INETD || global.conf->runmode == RUNMODE_FORKDAEMON )
    324                 g_main_quit( global.loop );
     324                b_main_quit();
    325325}
    326326
     
    605605       
    606606        if( irc->w_watch_source_id == 0 )
    607                 irc->w_watch_source_id = gaim_input_add( irc->fd, GAIM_INPUT_WRITE, bitlbee_io_current_client_write, irc );
     607                irc->w_watch_source_id = b_input_add( irc->fd, GAIM_INPUT_WRITE, bitlbee_io_current_client_write, irc );
    608608       
    609609        return;
     
    10111011}
    10121012
    1013 gboolean buddy_send_handler_delayed( gpointer data )
     1013static gboolean buddy_send_handler_delayed( gpointer data, gint fd, b_input_condition cond )
    10141014{
    10151015        user_t *u = data;
     
    10241024        u->sendbuf_flags = 0;
    10251025       
    1026         return( FALSE );
     1026        return FALSE;
    10271027}
    10281028
     
    10381038                {
    10391039                        //Flush the buffer
    1040                         g_source_remove( u->sendbuf_timer );
    1041                         buddy_send_handler_delayed( u );
     1040                        b_event_remove( u->sendbuf_timer );
     1041                        buddy_send_handler_delayed( u, -1, 0 );
    10421042                }
    10431043
     
    10631063               
    10641064                if( u->sendbuf_timer > 0 )
    1065                         g_source_remove( u->sendbuf_timer );
    1066                 u->sendbuf_timer = g_timeout_add( delay, buddy_send_handler_delayed, u );
     1065                        b_event_remove( u->sendbuf_timer );
     1066                u->sendbuf_timer = b_timeout_add( delay, buddy_send_handler_delayed, u );
    10671067        }
    10681068        else
     
    11481148   pongs from the user. When not connected yet, we don't ping but drop the
    11491149   connection when the user fails to connect in IRC_LOGIN_TIMEOUT secs. */
    1150 static gboolean irc_userping( gpointer _irc )
     1150static gboolean irc_userping( gpointer _irc, gint fd, b_input_condition cond )
    11511151{
    11521152        irc_t *irc = _irc;
  • protocols/events.h

    r67b6766 rba9edaa  
    4242        GAIM_INPUT_READ = 1 << 0,
    4343        GAIM_INPUT_WRITE = 1 << 1
    44 } GaimInputCondition;
    45 typedef void (*GaimInputFunction)(gpointer, gint, GaimInputCondition);
     44} b_input_condition;
     45typedef gboolean (*b_event_handler)(gpointer data, gint fd, b_input_condition cond);
    4646
    4747#define GAIM_READ_COND  (G_IO_IN | G_IO_HUP | G_IO_ERR)
     
    4949#define GAIM_ERR_COND   (G_IO_HUP | G_IO_ERR | G_IO_NVAL)
    5050
    51 G_MODULE_EXPORT gint gaim_input_add(int fd, GaimInputCondition cond, GaimInputFunction func, gpointer data);
    52 G_MODULE_EXPORT void gaim_input_remove(gint id);
     51G_MODULE_EXPORT void b_main_init();
     52G_MODULE_EXPORT void b_main_run();
     53G_MODULE_EXPORT void b_main_quit();
    5354
    54 G_MODULE_EXPORT gint bee_timeout_add(gint timeout, GaimInputFunction func, gpointer data, gint priority);
     55G_MODULE_EXPORT gint b_input_add(int fd, b_input_condition cond, b_event_handler func, gpointer data);
     56G_MODULE_EXPORT gint b_timeout_add(gint timeout, b_event_handler func, gpointer data);
     57G_MODULE_EXPORT void b_event_remove(gint id);
     58G_MODULE_EXPORT gboolean b_event_remove_by_data(gpointer data);
    5559
    5660#endif /* _EVENTS_H_ */
  • protocols/events_glib.c

    r67b6766 rba9edaa  
    4747
    4848typedef struct _GaimIOClosure {
    49         GaimInputFunction function;
     49        b_event_handler function;
    5050        guint result;
    5151        gpointer data;
    5252} GaimIOClosure;
    5353
     54static GMainLoop *loop;
     55
     56void b_main_init()
     57{
     58        loop = g_main_new( FALSE );
     59}
     60
     61void b_main_run()
     62{
     63        g_main_run( loop );
     64}
     65
     66void b_main_quit()
     67{
     68        g_main_quit( loop );
     69}
     70
    5471static gboolean gaim_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data)
    5572{
    5673        GaimIOClosure *closure = data;
    57         GaimInputCondition gaim_cond = 0;
     74        b_input_condition gaim_cond = 0;
    5875
    5976        if (condition & GAIM_READ_COND)
     
    6279                gaim_cond |= GAIM_INPUT_WRITE;
    6380
    64         closure->function(closure->data, g_io_channel_unix_get_fd(source), gaim_cond);
    65 
    66         return TRUE;
     81        return closure->function(closure->data, g_io_channel_unix_get_fd(source), gaim_cond);
    6782}
    6883
     
    7287}
    7388
    74 gint gaim_input_add(gint source, GaimInputCondition condition, GaimInputFunction function, gpointer data)
     89gint b_input_add(gint source, b_input_condition condition, b_event_handler function, gpointer data)
    7590{
    7691        GaimIOClosure *closure = g_new0(GaimIOClosure, 1);
     
    94109}
    95110
    96 void gaim_input_remove(gint tag)
     111gint b_timeout_add(gint timeout, b_event_handler func, gpointer data)
     112{
     113        return g_timeout_add(timeout, func, data);
     114}
     115
     116void b_event_remove(gint tag)
    97117{
    98118        if (tag > 0)
    99119                g_source_remove(tag);
    100120}
     121
     122gboolean b_event_remove_by_data(gpointer data)
     123{
     124        return g_source_remove_by_user_data(data);
     125}
  • protocols/http_client.c

    r67b6766 rba9edaa  
    3232
    3333
    34 static void http_connected( gpointer data, int source, GaimInputCondition cond );
    35 static void http_ssl_connected( gpointer data, void *source, GaimInputCondition cond );
    36 static void http_incoming_data( gpointer data, int source, GaimInputCondition cond );
     34static gboolean http_connected( gpointer data, int source, b_input_condition cond );
     35static gboolean http_ssl_connected( gpointer data, void *source, b_input_condition cond );
     36static gboolean http_incoming_data( gpointer data, int source, b_input_condition cond );
    3737
    3838
     
    7373/* This one is actually pretty simple... Might get more calls if we can't write
    7474   the whole request at once. */
    75 static void http_connected( gpointer data, int source, GaimInputCondition cond )
     75static gboolean http_connected( gpointer data, int source, b_input_condition cond )
    7676{
    7777        struct http_request *req = data;
     
    8282       
    8383        if( req->inpa > 0 )
    84                 gaim_input_remove( req->inpa );
     84                b_event_remove( req->inpa );
    8585       
    8686        sock_make_nonblocking( req->fd );
     
    117117       
    118118        if( req->bytes_written < req->request_length )
    119                 req->inpa = gaim_input_add( source,
    120                                             req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_WRITE,
    121                                             http_connected, req );
    122         else
    123                 req->inpa = gaim_input_add( source, GAIM_INPUT_READ, http_incoming_data, req );
    124        
    125         return;
     119                req->inpa = b_input_add( source,
     120                                         req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_WRITE,
     121                                         http_connected, req );
     122        else
     123                req->inpa = b_input_add( source, GAIM_INPUT_READ, http_incoming_data, req );
     124       
     125        return FALSE;
    126126       
    127127error:
     
    131131        g_free( req );
    132132       
    133         return;
     133        return FALSE;
    134134}
    135135
    136 static void http_ssl_connected( gpointer data, void *source, GaimInputCondition cond )
     136static gboolean http_ssl_connected( gpointer data, void *source, b_input_condition cond )
    137137{
    138138        struct http_request *req = data;
     
    146146}
    147147
    148 static void http_incoming_data( gpointer data, int source, GaimInputCondition cond )
     148static gboolean http_incoming_data( gpointer data, int source, b_input_condition cond )
    149149{
    150150        struct http_request *req = data;
     
    155155       
    156156        if( req->inpa > 0 )
    157                 gaim_input_remove( req->inpa );
     157                b_event_remove( req->inpa );
    158158       
    159159        if( req->ssl )
     
    202202       
    203203        /* There will be more! */
    204         req->inpa = gaim_input_add( req->fd,
    205                                     req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_READ,
    206                                     http_incoming_data, req );
    207        
    208         return;
     204        req->inpa = b_input_add( req->fd,
     205                                 req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_READ,
     206                                 http_incoming_data, req );
     207       
     208        return FALSE;
    209209
    210210got_reply:
     
    362362                req->reply_headers = req->reply_body = NULL;
    363363               
    364                 return;
     364                return FALSE;
    365365        }
    366366       
     
    380380        g_free( req->reply_headers );
    381381        g_free( req );
     382       
     383        return FALSE;
    382384}
  • protocols/jabber/jabber.c

    r67b6766 rba9edaa  
    471471}
    472472
    473 static void jabber_callback(gpointer data, gint source, GaimInputCondition condition)
     473static gboolean jabber_callback(gpointer data, gint source, b_input_condition condition)
    474474{
    475475        struct gaim_connection *gc = (struct gaim_connection *)data;
     
    477477
    478478        gjab_recv(jd->gjc);
     479       
     480        return TRUE;
    479481}
    480482
     
    487489}
    488490
    489 static void gjab_connected(gpointer data, gint source, GaimInputCondition cond)
     491static gboolean gjab_connected(gpointer data, gint source, b_input_condition cond)
    490492{
    491493        xmlnode x;
     
    497499        if (!g_slist_find(get_connections(), gc)) {
    498500                closesocket(source);
    499                 return;
     501                return FALSE;
    500502        }
    501503
     
    508510        if (source == -1) {
    509511                STATE_EVT(JCONN_STATE_OFF)
    510                 return;
     512                return FALSE;
    511513        }
    512514
     
    530532
    531533        gc = GJ_GC(gjc);
    532         gc->inpa = gaim_input_add(gjc->fd, GAIM_INPUT_READ, jabber_callback, gc);
    533 }
    534 
    535 static void gjab_connected_ssl(gpointer data, void *source, GaimInputCondition cond)
     534        gc->inpa = b_input_add(gjc->fd, GAIM_INPUT_READ, jabber_callback, gc);
     535       
     536        return FALSE;
     537}
     538
     539static gboolean gjab_connected_ssl(gpointer data, void *source, b_input_condition cond)
    536540{
    537541        struct gaim_connection *gc = data;
     
    544548        if (source == NULL) {
    545549                STATE_EVT(JCONN_STATE_OFF)
    546                 return;
     550                return FALSE;
    547551        }
    548552       
    549553        if (!g_slist_find(get_connections(), gc)) {
    550554                ssl_disconnect(source);
    551                 return;
     555                return FALSE;
    552556        }
    553557       
    554         gjab_connected(data, gjc->fd, cond);
     558        return gjab_connected(data, gjc->fd, cond);
    555559}
    556560
     
    15431547}
    15441548
    1545 static gboolean jabber_free(gpointer data)
     1549static gboolean jabber_free(gpointer data, gint fd, b_input_condition cond)
    15461550{
    15471551        struct jabber_data *jd = data;
     
    15861590        }
    15871591        if (gc->inpa)
    1588                 gaim_input_remove(gc->inpa);
     1592                b_event_remove(gc->inpa);
    15891593
    15901594        if(jd) {
    1591                 g_timeout_add(50, jabber_free, jd);
     1595                b_timeout_add(50, jabber_free, jd);
    15921596                if(jd->gjc != NULL)
    15931597                        xmlnode_free(jd->gjc->current);
  • protocols/msn/msn.h

    r67b6766 rba9edaa  
    146146
    147147/* ns.c */
    148 void msn_ns_connected( gpointer data, gint source, GaimInputCondition cond );
     148gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond );
    149149
    150150/* msn_util.c */
     
    173173void msn_sb_to_chat( struct msn_switchboard *sb );
    174174void msn_sb_destroy( struct msn_switchboard *sb );
    175 void msn_sb_connected( gpointer data, gint source, GaimInputCondition cond );
     175gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond );
  • protocols/msn/ns.c

    r67b6766 rba9edaa  
    3030#include "md5.h"
    3131
    32 static void msn_ns_callback( gpointer data, gint source, GaimInputCondition cond );
     32static gboolean msn_ns_callback( gpointer data, gint source, b_input_condition cond );
    3333static int msn_ns_command( gpointer data, char **cmd, int num_parts );
    3434static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int num_parts );
     
    3636static void msn_auth_got_passport_id( struct passport_reply *rep );
    3737
    38 void msn_ns_connected( gpointer data, gint source, GaimInputCondition cond )
     38gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond )
    3939{
    4040        struct gaim_connection *gc = data;
     
    4343       
    4444        if( !g_slist_find( msn_connections, gc ) )
    45                 return;
     45                return FALSE;
    4646       
    4747        if( source == -1 )
     
    4949                hide_login_progress( gc, "Could not connect to server" );
    5050                signoff( gc );
    51                 return;
     51                return FALSE;
    5252        }
    5353       
     
    7575        if( msn_write( gc, s, strlen( s ) ) )
    7676        {
    77                 gc->inpa = gaim_input_add( md->fd, GAIM_INPUT_READ, msn_ns_callback, gc );
     77                gc->inpa = b_input_add( md->fd, GAIM_INPUT_READ, msn_ns_callback, gc );
    7878                set_login_progress( gc, 1, "Connected to server, waiting for reply" );
    7979        }
     80       
     81        return FALSE;
    8082}
    8183
    82 void msn_ns_callback( gpointer data, gint source, GaimInputCondition cond )
     84static gboolean msn_ns_callback( gpointer data, gint source, b_input_condition cond )
    8385{
    8486        struct gaim_connection *gc = data;
     
    8991                hide_login_progress( gc, "Error while reading from server" );
    9092                signoff( gc );
    91         }
     93               
     94                return FALSE;
     95        }
     96        else
     97                return TRUE;
    9298}
    9399
     
    130136                if( num_parts == 6 && strcmp( cmd[2], "NS" ) == 0 )
    131137                {
    132                         gaim_input_remove( gc->inpa );
     138                        b_event_remove( gc->inpa );
    133139                        gc->inpa = 0;
    134140                        closesocket( md->fd );
  • protocols/msn/sb.c

    r67b6766 rba9edaa  
    3030#include "md5.h"
    3131
    32 static void msn_sb_callback( gpointer data, gint source, GaimInputCondition cond );
     32static gboolean msn_sb_callback( gpointer data, gint source, b_input_condition cond );
    3333static int msn_sb_command( gpointer data, char **cmd, int num_parts );
    3434static int msn_sb_message( gpointer data, char *msg, int msglen, char **cmd, int num_parts );
     
    237237        }
    238238       
    239         if( sb->inp ) gaim_input_remove( sb->inp );
     239        if( sb->inp ) b_event_remove( sb->inp );
    240240        closesocket( sb->fd );
    241241       
     
    245245}
    246246
    247 void msn_sb_connected( gpointer data, gint source, GaimInputCondition cond )
     247gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond )
    248248{
    249249        struct msn_switchboard *sb = data;
     
    254254        /* Are we still alive? */
    255255        if( !g_slist_find( msn_switchboards, sb ) )
    256                 return;
     256                return FALSE;
    257257       
    258258        gc = sb->gc;
     
    263263                debug( "ERROR %d while connecting to switchboard server", 1 );
    264264                msn_sb_destroy( sb );
    265                 return;
     265                return FALSE;
    266266        }
    267267       
     
    280280       
    281281        if( msn_sb_write( sb, buf, strlen( buf ) ) )
    282                 sb->inp = gaim_input_add( sb->fd, GAIM_INPUT_READ, msn_sb_callback, sb );
     282                sb->inp = b_input_add( sb->fd, GAIM_INPUT_READ, msn_sb_callback, sb );
    283283        else
    284284                debug( "ERROR %d while connecting to switchboard server", 2 );
    285 }
    286 
    287 static void msn_sb_callback( gpointer data, gint source, GaimInputCondition cond )
     285       
     286        return FALSE;
     287}
     288
     289static gboolean msn_sb_callback( gpointer data, gint source, b_input_condition cond )
    288290{
    289291        struct msn_switchboard *sb = data;
     
    293295                debug( "ERROR: Switchboard died" );
    294296                msn_sb_destroy( sb );
    295         }
     297               
     298                return FALSE;
     299        }
     300        else
     301                return TRUE;
    296302}
    297303
  • protocols/nogaim.c

    r67b6766 rba9edaa  
    328328}
    329329
    330 static gboolean send_keepalive( gpointer d )
     330static gboolean send_keepalive( gpointer d, gint fd, b_input_condition cond )
    331331{
    332332        struct gaim_connection *gc = d;
     
    352352        serv_got_crap( gc, "Logged in" );
    353353       
    354         gc->keepalive = g_timeout_add( 60000, send_keepalive, gc );
     354        gc->keepalive = b_timeout_add( 60000, send_keepalive, gc );
    355355        gc->flags |= OPT_LOGGED_IN;
    356356       
     
    360360}
    361361
    362 gboolean auto_reconnect( gpointer data )
     362gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond )
    363363{
    364364        account_t *a = data;
     
    372372void cancel_auto_reconnect( account_t *a )
    373373{
    374         while( g_source_remove_by_user_data( (gpointer) a ) );
     374        while( b_event_remove_by_data( (gpointer) a ) );
    375375        a->reconnect = 0;
    376376}
     
    384384        serv_got_crap( gc, "Signing off.." );
    385385
    386         gaim_input_remove( gc->keepalive );
     386        b_event_remove( gc->keepalive );
    387387        gc->keepalive = 0;
    388388        gc->prpl->close( gc );
    389         gaim_input_remove( gc->inpa );
     389        b_event_remove( gc->inpa );
    390390       
    391391        while( u )
     
    417417               
    418418                a->reconnect = 1;
    419                 g_timeout_add( delay * 1000, auto_reconnect, a );
     419                b_timeout_add( delay * 1000, auto_reconnect, a );
    420420        }
    421421       
  • protocols/nogaim.h

    r67b6766 rba9edaa  
    201201char *set_eval_away_devoice( irc_t *irc, set_t *set, char *value );
    202202
    203 gboolean auto_reconnect( gpointer data );
     203gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond );
    204204void cancel_auto_reconnect( struct account *a );
    205205
  • protocols/oscar/oscar.c

    r67b6766 rba9edaa  
    253253static int msgerrreasonlen = 25;
    254254
    255 static void oscar_callback(gpointer data, gint source,
    256                                 GaimInputCondition condition) {
     255static gboolean oscar_callback(gpointer data, gint source,
     256                                b_input_condition condition) {
    257257        aim_conn_t *conn = (aim_conn_t *)data;
    258258        aim_session_t *sess = aim_conn_getsess(conn);
     
    262262        if (!gc) {
    263263                /* gc is null. we return, else we seg SIGSEG on next line. */
    264                 return;
     264                return FALSE;
    265265        }
    266266     
     
    268268                /* oh boy. this is probably bad. i guess the only thing we
    269269                 * can really do is return? */
    270                 return;
     270                return FALSE;
    271271        }
    272272
     
    288288                                c->conn = NULL;
    289289                                if (c->inpa > 0)
    290                                         gaim_input_remove(c->inpa);
     290                                        b_event_remove(c->inpa);
    291291                                c->inpa = 0;
    292292                                c->fd = -1;
     
    296296                        } else if (conn->type == AIM_CONN_TYPE_CHATNAV) {
    297297                                if (odata->cnpa > 0)
    298                                         gaim_input_remove(odata->cnpa);
     298                                        b_event_remove(odata->cnpa);
    299299                                odata->cnpa = 0;
    300300                                while (odata->create_rooms) {
     
    310310                        } else if (conn->type == AIM_CONN_TYPE_AUTH) {
    311311                                if (odata->paspa > 0)
    312                                         gaim_input_remove(odata->paspa);
     312                                        b_event_remove(odata->paspa);
    313313                                odata->paspa = 0;
    314314                                aim_conn_kill(odata->sess, &conn);
     
    317317                        }
    318318                }
    319         }
    320 }
    321 
    322 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond)
     319        } else {
     320                /* WTF??? */
     321                return FALSE;
     322        }
     323               
     324        return TRUE;
     325}
     326
     327static gboolean oscar_login_connect(gpointer data, gint source, b_input_condition cond)
    323328{
    324329        struct gaim_connection *gc = data;
     
    329334        if (!g_slist_find(get_connections(), gc)) {
    330335                closesocket(source);
    331                 return;
     336                return FALSE;
    332337        }
    333338
     
    339344                hide_login_progress(gc, _("Couldn't connect to host"));
    340345                signoff(gc);
    341                 return;
     346                return FALSE;
    342347        }
    343348
    344349        aim_conn_completeconnect(sess, conn);
    345         gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ,
     350        gc->inpa = b_input_add(conn->fd, GAIM_INPUT_READ,
    346351                        oscar_callback, conn);
     352       
     353        return FALSE;
    347354}
    348355
     
    412419                struct chat_connection *n = odata->oscar_chats->data;
    413420                if (n->inpa > 0)
    414                         gaim_input_remove(n->inpa);
     421                        b_event_remove(n->inpa);
    415422                g_free(n->name);
    416423                g_free(n->show);
     
    431438                g_free(odata->oldp);
    432439        if (gc->inpa > 0)
    433                 gaim_input_remove(gc->inpa);
     440                b_event_remove(gc->inpa);
    434441        if (odata->cnpa > 0)
    435                 gaim_input_remove(odata->cnpa);
     442                b_event_remove(odata->cnpa);
    436443        if (odata->paspa > 0)
    437                 gaim_input_remove(odata->paspa);
     444                b_event_remove(odata->paspa);
    438445        aim_session_kill(odata->sess);
    439446        g_free(odata->sess);
     
    443450}
    444451
    445 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) {
     452static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition cond) {
    446453        struct gaim_connection *gc = data;
    447454        struct oscar_data *odata;
     
    451458        if (!g_slist_find(get_connections(), gc)) {
    452459                closesocket(source);
    453                 return;
     460                return FALSE;
    454461        }
    455462
     
    461468                hide_login_progress(gc, _("Could Not Connect"));
    462469                signoff(gc);
    463                 return;
     470                return FALSE;
    464471        }
    465472
    466473        aim_conn_completeconnect(sess, bosconn);
    467         gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ,
     474        gc->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,
    468475                        oscar_callback, bosconn);
    469476        set_login_progress(gc, 4, _("Connection established, cookie sent"));
     477       
     478        return FALSE;
    470479}
    471480
     
    570579        }
    571580        aim_sendcookie(sess, bosconn, info->cookie);
    572         gaim_input_remove(gc->inpa);
     581        b_event_remove(gc->inpa);
    573582
    574583        return 1;
     
    585594};
    586595
    587 static void damn_you(gpointer data, gint source, GaimInputCondition c)
     596static gboolean damn_you(gpointer data, gint source, b_input_condition c)
    588597{
    589598        struct pieceofcrap *pos = data;
     
    605614                do_error_dialog(pos->gc, "Gaim was unable to get a valid hash for logging into AIM."
    606615                                " You may be disconnected shortly.", "Login Error");
    607                 gaim_input_remove(pos->inpa);
     616                b_event_remove(pos->inpa);
    608617                closesocket(pos->fd);
    609618                g_free(pos);
    610                 return;
     619                return FALSE;
    611620        }
    612621        /* [WvG] Wheeeee! Who needs error checking anyway? ;-) */
    613622        read(pos->fd, m, 16);
    614623        m[16] = '\0';
    615         gaim_input_remove(pos->inpa);
     624        b_event_remove(pos->inpa);
    616625        closesocket(pos->fd);
    617626        aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH);
    618627        g_free(pos);
    619 }
    620 
    621 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) {
     628       
     629        return FALSE;
     630}
     631
     632static gboolean straight_to_hell(gpointer data, gint source, b_input_condition cond) {
    622633        struct pieceofcrap *pos = data;
    623634        char buf[BUF_LONG];
     
    629640                        g_free(pos->modname);
    630641                g_free(pos);
    631                 return;
     642                return FALSE;
    632643        }
    633644
     
    638649        if (pos->modname)
    639650                g_free(pos->modname);
    640         pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);
    641         return;
     651        pos->inpa = b_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);
     652        return FALSE;
    642653}
    643654
     
    761772}
    762773
    763 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) {
     774static gboolean oscar_chatnav_connect(gpointer data, gint source, b_input_condition cond) {
    764775        struct gaim_connection *gc = data;
    765776        struct oscar_data *odata;
     
    769780        if (!g_slist_find(get_connections(), gc)) {
    770781                closesocket(source);
    771                 return;
     782                return FALSE;
    772783        }
    773784
     
    778789        if (source < 0) {
    779790                aim_conn_kill(sess, &tstconn);
    780                 return;
     791                return FALSE;
    781792        }
    782793
    783794        aim_conn_completeconnect(sess, tstconn);
    784         odata->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,
     795        odata->cnpa = b_input_add(tstconn->fd, GAIM_INPUT_READ,
    785796                                        oscar_callback, tstconn);
    786 }
    787 
    788 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond)
     797       
     798        return FALSE;
     799}
     800
     801static gboolean oscar_auth_connect(gpointer data, gint source, b_input_condition cond)
    789802{
    790803        struct gaim_connection *gc = data;
     
    795808        if (!g_slist_find(get_connections(), gc)) {
    796809                closesocket(source);
    797                 return;
     810                return FALSE;
    798811        }
    799812
     
    804817        if (source < 0) {
    805818                aim_conn_kill(sess, &tstconn);
    806                 return;
     819                return FALSE;
    807820        }
    808821
    809822        aim_conn_completeconnect(sess, tstconn);
    810         odata->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,
     823        odata->paspa = b_input_add(tstconn->fd, GAIM_INPUT_READ,
    811824                                oscar_callback, tstconn);
    812 }
    813 
    814 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond)
     825       
     826        return FALSE;
     827}
     828
     829static gboolean oscar_chat_connect(gpointer data, gint source, b_input_condition cond)
    815830{
    816831        struct chat_connection *ccon = data;
     
    825840                g_free(ccon->name);
    826841                g_free(ccon);
    827                 return;
     842                return FALSE;
    828843        }
    829844
     
    837852                g_free(ccon->name);
    838853                g_free(ccon);
    839                 return;
     854                return FALSE;
    840855        }
    841856
    842857        aim_conn_completeconnect(sess, ccon->conn);
    843         ccon->inpa = gaim_input_add(tstconn->fd,
     858        ccon->inpa = b_input_add(tstconn->fd,
    844859                        GAIM_INPUT_READ,
    845860                        oscar_callback, tstconn);
    846861        odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon);
     862       
     863        return FALSE;
    847864}
    848865
     
    25582575        od->oscar_chats = g_slist_remove(od->oscar_chats, cc);
    25592576        if (cc->inpa > 0)
    2560                 gaim_input_remove(cc->inpa);
     2577                b_event_remove(cc->inpa);
    25612578        aim_conn_kill(od->sess, &cc->conn);
    25622579        g_free(cc->name);
  • protocols/proxy.c

    r67b6766 rba9edaa  
    4949
    5050struct PHB {
    51         GaimInputFunction func, proxy_func;
     51        b_event_handler func, proxy_func;
    5252        gpointer data, proxy_data;
    5353        char *host;
     
    7878}
    7979
    80 static void gaim_io_connected(gpointer data, gint source, GaimInputCondition cond)
     80static gboolean gaim_io_connected(gpointer data, gint source, b_input_condition cond)
    8181{
    8282        struct PHB *phb = data;
     
    8888        if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
    8989                closesocket(source);
    90                 gaim_input_remove(phb->inpa);
     90                b_event_remove(phb->inpa);
    9191                if( phb->proxy_func )
    9292                        phb->proxy_func(phb->proxy_data, -1, GAIM_INPUT_READ);
     
    9595                        g_free(phb);
    9696                }
    97                 return;
     97                return FALSE;
    9898        }
    9999#endif
    100100        sock_make_blocking(source);
    101         gaim_input_remove(phb->inpa);
     101        b_event_remove(phb->inpa);
    102102        if( phb->proxy_func )
    103103                phb->proxy_func(phb->proxy_data, source, GAIM_INPUT_READ);
     
    106106                g_free(phb);
    107107        }
     108       
     109        return FALSE;
    108110}
    109111
     
    127129        if (connect(fd, (struct sockaddr *)sin, sizeof(*sin)) < 0) {
    128130                if (sockerr_again()) {
    129                         phb->inpa = gaim_input_add(fd, GAIM_INPUT_WRITE, gaim_io_connected, phb);
     131                        phb->inpa = b_input_add(fd, GAIM_INPUT_WRITE, gaim_io_connected, phb);
    130132                        phb->fd = fd;
    131133                } else {
     
    145147#define HTTP_GOODSTRING2 "HTTP/1.1 200 Connection established"
    146148
    147 static void http_canread(gpointer data, gint source, GaimInputCondition cond)
     149static gboolean http_canread(gpointer data, gint source, b_input_condition cond)
    148150{
    149151        int nlc = 0;
     
    152154        char inputline[8192];
    153155
    154         gaim_input_remove(phb->inpa);
     156        b_event_remove(phb->inpa);
    155157
    156158        while ((pos < sizeof(inputline)-1) && (nlc != 2) && (read(source, &inputline[pos++], 1) == 1)) {
     
    167169                g_free(phb->host);
    168170                g_free(phb);
    169                 return;
     171                return FALSE;
    170172        }
    171173
     
    174176        g_free(phb->host);
    175177        g_free(phb);
    176         return;
    177 }
    178 
    179 static void http_canwrite(gpointer data, gint source, GaimInputCondition cond)
     178       
     179        return FALSE;
     180}
     181
     182static gboolean http_canwrite(gpointer data, gint source, b_input_condition cond)
    180183{
    181184        char cmd[384];
     
    184187        int error = ETIMEDOUT;
    185188        if (phb->inpa > 0)
    186                 gaim_input_remove(phb->inpa);
     189                b_event_remove(phb->inpa);
    187190        len = sizeof(error);
    188191        if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
     
    191194                g_free(phb->host);
    192195                g_free(phb);
    193                 return;
     196                return FALSE;
    194197        }
    195198        sock_make_blocking(source);
     
    202205                g_free(phb->host);
    203206                g_free(phb);
    204                 return;
     207                return FALSE;
    205208        }
    206209
     
    217220                        g_free(phb->host);
    218221                        g_free(phb);
    219                         return;
     222                        return FALSE;
    220223                }
    221224        }
     
    227230                g_free(phb->host);
    228231                g_free(phb);
    229                 return;
    230         }
    231 
    232         phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, http_canread, phb);
     232                return FALSE;
     233        }
     234
     235        phb->inpa = b_input_add(source, GAIM_INPUT_READ, http_canread, phb);
     236       
     237        return FALSE;
    233238}
    234239
     
    246251/* Connecting to SOCKS4 proxies */
    247252
    248 static void s4_canread(gpointer data, gint source, GaimInputCondition cond)
     253static gboolean s4_canread(gpointer data, gint source, b_input_condition cond)
    249254{
    250255        unsigned char packet[12];
    251256        struct PHB *phb = data;
    252257
    253         gaim_input_remove(phb->inpa);
     258        b_event_remove(phb->inpa);
    254259
    255260        memset(packet, 0, sizeof(packet));
     
    258263                g_free(phb->host);
    259264                g_free(phb);
    260                 return;
     265                return FALSE;
    261266        }
    262267
     
    265270        g_free(phb->host);
    266271        g_free(phb);
    267 }
    268 
    269 static void s4_canwrite(gpointer data, gint source, GaimInputCondition cond)
     272       
     273        return FALSE;
     274}
     275
     276static gboolean s4_canwrite(gpointer data, gint source, b_input_condition cond)
    270277{
    271278        unsigned char packet[12];
     
    275282        int error = ETIMEDOUT;
    276283        if (phb->inpa > 0)
    277                 gaim_input_remove(phb->inpa);
     284                b_event_remove(phb->inpa);
    278285        len = sizeof(error);
    279286        if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
     
    282289                g_free(phb->host);
    283290                g_free(phb);
    284                 return;
     291                return FALSE;
    285292        }
    286293        sock_make_blocking(source);
     
    292299                g_free(phb->host);
    293300                g_free(phb);
    294                 return;
     301                return FALSE;
    295302        }
    296303
     
    309316                g_free(phb->host);
    310317                g_free(phb);
    311                 return;
    312         }
    313 
    314         phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, s4_canread, phb);
     318                return FALSE;
     319        }
     320
     321        phb->inpa = b_input_add(source, GAIM_INPUT_READ, s4_canread, phb);
     322       
     323        return FALSE;
    315324}
    316325
     
    328337/* Connecting to SOCKS5 proxies */
    329338
    330 static void s5_canread_again(gpointer data, gint source, GaimInputCondition cond)
     339static gboolean s5_canread_again(gpointer data, gint source, b_input_condition cond)
    331340{
    332341        unsigned char buf[512];
    333342        struct PHB *phb = data;
    334343
    335         gaim_input_remove(phb->inpa);
     344        b_event_remove(phb->inpa);
    336345
    337346        if (read(source, buf, 10) < 10) {
     
    340349                g_free(phb->host);
    341350                g_free(phb);
    342                 return;
     351                return FALSE;
    343352        }
    344353        if ((buf[0] != 0x05) || (buf[1] != 0x00)) {
     
    347356                g_free(phb->host);
    348357                g_free(phb);
    349                 return;
     358                return FALSE;
    350359        }
    351360
     
    353362        g_free(phb->host);
    354363        g_free(phb);
    355         return;
     364       
     365        return FALSE;
    356366}
    357367
     
    361371        struct PHB *phb = data;
    362372        int hlen = strlen(phb->host);
    363 
     373       
    364374        buf[0] = 0x05;
    365375        buf[1] = 0x01;          /* CONNECT */
     
    379389        }
    380390
    381         phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, s5_canread_again, phb);
    382 }
    383 
    384 static void s5_readauth(gpointer data, gint source, GaimInputCondition cond)
     391        phb->inpa = b_input_add(source, GAIM_INPUT_READ, s5_canread_again, phb);
     392}
     393
     394static gboolean s5_readauth(gpointer data, gint source, b_input_condition cond)
    385395{
    386396        unsigned char buf[512];
    387397        struct PHB *phb = data;
    388398
    389         gaim_input_remove(phb->inpa);
     399        b_event_remove(phb->inpa);
    390400
    391401        if (read(source, buf, 2) < 2) {
     
    394404                g_free(phb->host);
    395405                g_free(phb);
    396                 return;
     406                return FALSE;
    397407        }
    398408
     
    402412                g_free(phb->host);
    403413                g_free(phb);
    404                 return;
     414                return FALSE;
    405415        }
    406416
    407417        s5_sendconnect(phb, source);
    408 }
    409 
    410 static void s5_canread(gpointer data, gint source, GaimInputCondition cond)
     418       
     419        return FALSE;
     420}
     421
     422static gboolean s5_canread(gpointer data, gint source, b_input_condition cond)
    411423{
    412424        unsigned char buf[512];
    413425        struct PHB *phb = data;
    414426
    415         gaim_input_remove(phb->inpa);
     427        b_event_remove(phb->inpa);
    416428
    417429        if (read(source, buf, 2) < 2) {
     
    420432                g_free(phb->host);
    421433                g_free(phb);
    422                 return;
     434                return FALSE;
    423435        }
    424436
     
    428440                g_free(phb->host);
    429441                g_free(phb);
    430                 return;
     442                return FALSE;
    431443        }
    432444
     
    443455                        g_free(phb->host);
    444456                        g_free(phb);
    445                         return;
     457                        return FALSE;
    446458                }
    447459
    448                 phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, s5_readauth, phb);
     460                phb->inpa = b_input_add(source, GAIM_INPUT_READ, s5_readauth, phb);
    449461        } else {
    450462                s5_sendconnect(phb, source);
    451463        }
    452 }
    453 
    454 static void s5_canwrite(gpointer data, gint source, GaimInputCondition cond)
     464       
     465        return FALSE;
     466}
     467
     468static gboolean s5_canwrite(gpointer data, gint source, b_input_condition cond)
    455469{
    456470        unsigned char buf[512];
     
    460474        int error = ETIMEDOUT;
    461475        if (phb->inpa > 0)
    462                 gaim_input_remove(phb->inpa);
     476                b_event_remove(phb->inpa);
    463477        len = sizeof(error);
    464478        if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
     
    467481                g_free(phb->host);
    468482                g_free(phb);
    469                 return;
     483                return FALSE;
    470484        }
    471485        sock_make_blocking(source);
     
    489503                g_free(phb->host);
    490504                g_free(phb);
    491                 return;
    492         }
    493 
    494         phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, s5_canread, phb);
     505                return FALSE;
     506        }
     507
     508        phb->inpa = b_input_add(source, GAIM_INPUT_READ, s5_canread, phb);
     509       
     510        return FALSE;
    495511}
    496512
     
    508524/* Export functions */
    509525
    510 int proxy_connect(const char *host, int port, GaimInputFunction func, gpointer data)
     526int proxy_connect(const char *host, int port, b_event_handler func, gpointer data)
    511527{
    512528        struct PHB *phb;
  • protocols/proxy.h

    r67b6766 rba9edaa  
    4949extern char proxypass[128];
    5050
    51 G_MODULE_EXPORT int proxy_connect(const char *host, int port, GaimInputFunction func, gpointer data);
     51G_MODULE_EXPORT int proxy_connect(const char *host, int port, b_event_handler func, gpointer data);
    5252
    5353#endif /* _PROXY_H_ */
  • protocols/ssl_bogus.c

    r67b6766 rba9edaa  
    5252}
    5353
    54 GaimInputCondition ssl_getdirection( void *conn )
     54b_input_condition ssl_getdirection( void *conn )
    5555{
    5656        return GAIM_INPUT_READ;
  • protocols/ssl_client.h

    r67b6766 rba9edaa  
    3333extern int ssl_errno;
    3434
    35 typedef void (*ssl_input_function)(gpointer, void*, GaimInputCondition);
     35typedef gboolean (*ssl_input_function)(gpointer, void*, b_input_condition);
    3636
    3737G_MODULE_EXPORT void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data );
     
    4040G_MODULE_EXPORT void ssl_disconnect( void *conn_ );
    4141G_MODULE_EXPORT int ssl_getfd( void *conn );
    42 G_MODULE_EXPORT GaimInputCondition ssl_getdirection( void *conn );
     42G_MODULE_EXPORT b_input_condition ssl_getdirection( void *conn );
  • protocols/ssl_gnutls.c

    r67b6766 rba9edaa  
    4848};
    4949
    50 static void ssl_connected( gpointer data, gint source, GaimInputCondition cond );
     50static void ssl_connected( gpointer data, gint source, b_input_condition cond );
    5151
    5252
     
    8181}
    8282
    83 static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond );
    84 
    85 static void ssl_connected( gpointer data, gint source, GaimInputCondition cond )
     83static void ssl_handshake( gpointer data, gint source, b_input_condition cond );
     84
     85static void ssl_connected( gpointer data, gint source, b_input_condition cond )
    8686{
    8787        struct scd *conn = data;
     
    105105}
    106106
    107 static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond )
     107static void ssl_handshake( gpointer data, gint source, b_input_condition cond )
    108108{
    109109        struct scd *conn = data;
     
    204204}
    205205
    206 GaimInputCondition ssl_getdirection( void *conn )
     206b_input_condition ssl_getdirection( void *conn )
    207207{
    208208        return( gnutls_record_get_direction( ((struct scd*)conn)->session ) ?
  • protocols/ssl_nss.c

    r67b6766 rba9edaa  
    5252};
    5353
    54 static void ssl_connected( gpointer data, gint source, GaimInputCondition cond );
     54static gboolean ssl_connected( gpointer data, gint source, b_input_condition cond );
    5555
    5656
     
    116116}
    117117
    118 static void ssl_connected( gpointer data, gint source, GaimInputCondition cond )
     118static gboolean ssl_connected( gpointer data, gint source, b_input_condition cond )
    119119{
    120120        struct scd *conn = data;
     
    140140        conn->established = TRUE;
    141141        conn->func( conn->data, conn, cond );
    142         return;
     142        return FALSE;
    143143       
    144144        ssl_connected_failure:
     
    149149        if( source >= 0 ) closesocket( source );
    150150        g_free( conn );
     151       
     152        return FALSE;
    151153}
    152154
     
    182184}
    183185
    184 GaimInputCondition ssl_getdirection( void *conn )
     186b_input_condition ssl_getdirection( void *conn )
    185187{
    186188        /* Just in case someone calls us, let's return the most likely case: */
  • protocols/ssl_openssl.c

    r67b6766 rba9edaa  
    5252};
    5353
    54 static void ssl_connected( gpointer data, gint source, GaimInputCondition cond );
     54static void ssl_connected( gpointer data, gint source, b_input_condition cond );
    5555
    5656
     
    9595}
    9696
    97 static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond );
    98 
    99 static void ssl_connected( gpointer data, gint source, GaimInputCondition cond )
     97static void ssl_handshake( gpointer data, gint source, b_input_condition cond );
     98
     99static void ssl_connected( gpointer data, gint source, b_input_condition cond )
    100100{
    101101        struct scd *conn = data;
     
    111111}       
    112112
    113 static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond )
     113static void ssl_handshake( gpointer data, gint source, b_input_condition cond )
    114114{
    115115        struct scd *conn = data;
     
    221221}
    222222
    223 GaimInputCondition ssl_getdirection( void *conn )
     223b_input_condition ssl_getdirection( void *conn )
    224224{
    225225        return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? GAIM_INPUT_WRITE : GAIM_INPUT_READ );
  • protocols/yahoo/yahoo.c

    r67b6766 rba9edaa  
    443443};
    444444
    445 void byahoo_connect_callback( gpointer data, gint source, GaimInputCondition cond )
     445void byahoo_connect_callback( gpointer data, gint source, b_input_condition cond )
    446446{
    447447        struct byahoo_connect_callback_data *d = data;
     
    465465};
    466466
    467 void byahoo_read_ready_callback( gpointer data, gint source, GaimInputCondition cond )
     467gboolean byahoo_read_ready_callback( gpointer data, gint source, b_input_condition cond )
    468468{
    469469        struct byahoo_read_ready_data *d = data;
     
    473473                /* WTF doesn't libyahoo clean this up? */
    474474                ext_yahoo_remove_handler( d->id, d->tag );
    475                 return;
     475                return FALSE;
    476476        }
    477477       
     
    487487};
    488488
    489 void byahoo_write_ready_callback( gpointer data, gint source, GaimInputCondition cond )
     489gboolean byahoo_write_ready_callback( gpointer data, gint source, b_input_condition cond )
    490490{
    491491        struct byahoo_write_ready_data *d = data;
     
    495495                /* WTF doesn't libyahoo clean this up? */
    496496                ext_yahoo_remove_handler( d->id, d->tag );
    497                 return;
     497                return FALSE;
    498498        }
    499499       
     
    686686               
    687687                inp->d = d;
    688                 d->tag = inp->h = gaim_input_add( fd, GAIM_INPUT_READ, (GaimInputFunction) byahoo_read_ready_callback, (gpointer) d );
     688                d->tag = inp->h = b_input_add( fd, GAIM_INPUT_READ, (b_event_handler) byahoo_read_ready_callback, (gpointer) d );
    689689        }
    690690        else if( cond == YAHOO_INPUT_WRITE )
     
    697697               
    698698                inp->d = d;
    699                 d->tag = inp->h = gaim_input_add( fd, GAIM_INPUT_WRITE, (GaimInputFunction) byahoo_write_ready_callback, (gpointer) d );
     699                d->tag = inp->h = b_input_add( fd, GAIM_INPUT_WRITE, (b_event_handler) byahoo_write_ready_callback, (gpointer) d );
    700700        }
    701701        else
     
    728728        }
    729729       
    730         gaim_input_remove( tag );
     730        b_event_remove( tag );
    731731}
    732732
     
    737737       
    738738        d = g_new0( struct byahoo_connect_callback_data, 1 );
    739         if( ( fd = proxy_connect( host, port, (GaimInputFunction) byahoo_connect_callback, (gpointer) d ) ) < 0 )
     739        if( ( fd = proxy_connect( host, port, (b_event_handler) byahoo_connect_callback, (gpointer) d ) ) < 0 )
    740740        {
    741741                g_free( d );
  • unix.c

    r67b6766 rba9edaa  
    4747        memset( &global, 0, sizeof( global_t ) );
    4848       
    49         global.loop = g_main_new( FALSE );
     49        b_main_init();
    5050       
    5151        log_init();
     
    117117                log_message( LOGLVL_WARNING, "Error opening helpfile %s.", HELP_FILE );
    118118       
    119         g_main_run( global.loop );
     119        b_main_run();
    120120       
    121121        if( global.restart )
     
    165165                       
    166166                        log_message( LOGLVL_ERROR, "SIGTERM received, cleaning up process." );
    167                         g_timeout_add_full( G_PRIORITY_LOW, 1, (GSourceFunc) bitlbee_shutdown, NULL, NULL );
     167                        b_timeout_add( 1, (b_event_handler) bitlbee_shutdown, NULL );
    168168                       
    169169                        first = 0;
  • user.c

    r67b6766 rba9edaa  
    109109                        if( u->handle ) g_free( u->handle );
    110110                        if( u->sendbuf ) g_free( u->sendbuf );
    111                         if( u->sendbuf_timer ) g_source_remove( u->sendbuf_timer );
     111                        if( u->sendbuf_timer ) b_event_remove( u->sendbuf_timer );
    112112                        g_free( u );
    113113                       
Note: See TracChangeset for help on using the changeset viewer.