diff options
-rw-r--r-- | bitlbee.c | 57 | ||||
-rw-r--r-- | bitlbee.h | 13 | ||||
-rw-r--r-- | ipc.c | 28 | ||||
-rw-r--r-- | ipc.h | 4 | ||||
-rw-r--r-- | irc.c | 36 | ||||
-rw-r--r-- | protocols/events.h | 14 | ||||
-rw-r--r-- | protocols/events_glib.c | 39 | ||||
-rw-r--r-- | protocols/http_client.c | 40 | ||||
-rw-r--r-- | protocols/jabber/jabber.c | 28 | ||||
-rw-r--r-- | protocols/msn/msn.h | 4 | ||||
-rw-r--r-- | protocols/msn/ns.c | 20 | ||||
-rw-r--r-- | protocols/msn/sb.c | 20 | ||||
-rw-r--r-- | protocols/nogaim.c | 14 | ||||
-rw-r--r-- | protocols/nogaim.h | 2 | ||||
-rw-r--r-- | protocols/oscar/oscar.c | 99 | ||||
-rw-r--r-- | protocols/proxy.c | 114 | ||||
-rw-r--r-- | protocols/proxy.h | 2 | ||||
-rw-r--r-- | protocols/ssl_bogus.c | 2 | ||||
-rw-r--r-- | protocols/ssl_client.h | 4 | ||||
-rw-r--r-- | protocols/ssl_gnutls.c | 10 | ||||
-rw-r--r-- | protocols/ssl_nss.c | 10 | ||||
-rw-r--r-- | protocols/ssl_openssl.c | 10 | ||||
-rw-r--r-- | protocols/yahoo/yahoo.c | 18 | ||||
-rw-r--r-- | unix.c | 6 | ||||
-rw-r--r-- | user.c | 2 |
25 files changed, 342 insertions, 254 deletions
@@ -33,7 +33,7 @@ #include <stdio.h> #include <errno.h> -void bitlbee_io_new_client( gpointer data, gint source, GaimInputCondition condition ); +static gboolean bitlbee_io_new_client( gpointer data, gint source, b_input_condition condition ); int bitlbee_daemon_init() { @@ -89,7 +89,7 @@ int bitlbee_daemon_init() return( -1 ); } - global.listen_watch_source_id = gaim_input_add( global.listen_socket, GAIM_INPUT_READ, bitlbee_io_new_client, NULL ); + global.listen_watch_source_id = b_input_add( global.listen_socket, GAIM_INPUT_READ, bitlbee_io_new_client, NULL ); #ifndef _WIN32 if( !global.conf->nofork ) @@ -144,7 +144,7 @@ int bitlbee_inetd_init() return( 0 ); } -void bitlbee_io_current_client_read( gpointer data, gint source, GaimInputCondition cond ) +gboolean bitlbee_io_current_client_read( gpointer data, gint source, b_input_condition cond ) { irc_t *irc = data; char line[513]; @@ -154,18 +154,18 @@ void bitlbee_io_current_client_read( gpointer data, gint source, GaimInputCondit if( st == 0 ) { irc_abort( irc, 1, "Connection reset by peer" ); - goto no_more_events; + return FALSE; } else if( st < 0 ) { if( sockerr_again() ) { - return; + return TRUE; } else { irc_abort( irc, 1, "Read error: %s", strerror( errno ) ); - goto no_more_events; + return FALSE; } } @@ -186,31 +186,27 @@ void bitlbee_io_current_client_read( gpointer data, gint source, GaimInputCondit if( !g_slist_find( irc_connection_list, irc ) ) { log_message( LOGLVL_WARNING, "Abnormal termination of connection with fd %d.", irc->fd ); - goto no_more_events; + return FALSE; } /* Very naughty, go read the RFCs! >:) */ if( irc->readbuffer && ( strlen( irc->readbuffer ) > 1024 ) ) { irc_abort( irc, 0, "Maximum line length exceeded" ); - goto no_more_events; + return FALSE; } - return; - -no_more_events: - gaim_input_remove( irc->r_watch_source_id ); - irc->r_watch_source_id = 0; + return TRUE; } -void bitlbee_io_current_client_write( gpointer data, gint source, GaimInputCondition cond ) +gboolean bitlbee_io_current_client_write( gpointer data, gint source, b_input_condition cond ) { irc_t *irc = data; int st, size; char *temp; if( irc->sendbuffer == NULL ) - goto no_more_events; + return FALSE; size = strlen( irc->sendbuffer ); st = write( irc->fd, irc->sendbuffer, size ); @@ -218,22 +214,23 @@ void bitlbee_io_current_client_write( gpointer data, gint source, GaimInputCondi if( st == 0 || ( st < 0 && !sockerr_again() ) ) { irc_abort( irc, 1, "Write error: %s", strerror( errno ) ); - goto no_more_events; + return FALSE; } else if( st < 0 ) /* && sockerr_again() */ { - return; + return TRUE; } if( st == size ) { g_free( irc->sendbuffer ); irc->sendbuffer = NULL; + irc->w_watch_source_id = 0; if( irc->status == USTATUS_SHUTDOWN ) irc_free( irc ); - goto no_more_events; + return FALSE; } else { @@ -241,15 +238,11 @@ void bitlbee_io_current_client_write( gpointer data, gint source, GaimInputCondi g_free( irc->sendbuffer ); irc->sendbuffer = temp; - return; + return TRUE; } - -no_more_events: - gaim_input_remove( irc->w_watch_source_id ); - irc->w_watch_source_id = 0; } -void bitlbee_io_new_client( gpointer data, gint source, GaimInputCondition condition ) +static gboolean bitlbee_io_new_client( gpointer data, gint source, b_input_condition condition ) { socklen_t size = sizeof( struct sockaddr_in ); struct sockaddr_in conn_info; @@ -259,7 +252,7 @@ void bitlbee_io_new_client( gpointer data, gint source, GaimInputCondition condi if( new_socket == -1 ) { log_message( LOGLVL_WARNING, "Could not accept new connection: %s", strerror( errno ) ); - return; + return TRUE; } if( global.conf->runmode == RUNMODE_FORKDAEMON ) @@ -284,7 +277,7 @@ void bitlbee_io_new_client( gpointer data, gint source, GaimInputCondition condi child = g_new0( struct bitlbee_child, 1 ); child->pid = client_pid; child->ipc_fd = fds[0]; - child->ipc_inpa = gaim_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child ); + child->ipc_inpa = b_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child ); child_list = g_slist_append( child_list, child ); log_message( LOGLVL_INFO, "Creating new subprocess with pid %d.", client_pid ); @@ -299,14 +292,14 @@ void bitlbee_io_new_client( gpointer data, gint source, GaimInputCondition condi /* Close the listening socket, we're a client. */ close( global.listen_socket ); - g_source_remove( global.listen_watch_source_id ); + b_event_remove( global.listen_watch_source_id ); /* Make the connection. */ irc = irc_new( new_socket ); /* We can store the IPC fd there now. */ global.listen_socket = fds[1]; - global.listen_watch_source_id = gaim_input_add( fds[1], GAIM_INPUT_READ, ipc_child_read, irc ); + global.listen_watch_source_id = b_input_add( fds[1], GAIM_INPUT_READ, ipc_child_read, irc ); close( fds[0] ); @@ -318,14 +311,18 @@ void bitlbee_io_new_client( gpointer data, gint source, GaimInputCondition condi log_message( LOGLVL_INFO, "Creating new connection with fd %d.", new_socket ); irc_new( new_socket ); } + + return TRUE; } -void bitlbee_shutdown( gpointer data ) +gboolean bitlbee_shutdown( gpointer data, gint fd, b_input_condition cond ) { /* Try to save data for all active connections (if desired). */ while( irc_connection_list != NULL ) irc_free( irc_connection_list->data ); /* We'll only reach this point when not running in inetd mode: */ - g_main_quit( global.loop ); + b_main_quit(); + + return FALSE; } @@ -81,8 +81,12 @@ #define g_timeout_add __PLEASE_USE_B_TIMEOUT_ADD__ #undef g_timeout_add_full #define g_timeout_add_full __PLEASE_USE_B_TIMEOUT_ADD__ +#undef g_io_add_watch +#define g_io_add_watch __PLEASE_USE_B_INPUT_ADD__ +#undef g_io_add_watch_full +#define g_io_add_watch_full __PLEASE_USE_B_INPUT_ADD__ #undef g_source_remove -#define g_source_remove __PLEASE_USE_B_SOURCE_REMOVE__ +#define g_source_remove __PLEASE_USE_B_EVENT_REMOVE__ #undef g_source_remove_by_user_data #define g_source_remove_by_user_data __PLEASE_USE_B_SOURCE_REMOVE_BY_USER_DATA__ #undef g_main_run @@ -136,19 +140,18 @@ typedef struct global { conf_t *conf; GList *storage; /* The first backend in the list will be used for saving */ char *helpfile; - GMainLoop *loop; int restart; } global_t; int bitlbee_daemon_init( void ); int bitlbee_inetd_init( void ); -void bitlbee_io_current_client_read( gpointer data, gint source, GaimInputCondition cond ); -void bitlbee_io_current_client_write( gpointer data, gint source, GaimInputCondition cond ); +gboolean bitlbee_io_current_client_read( gpointer data, gint source, b_input_condition cond ); +gboolean bitlbee_io_current_client_write( gpointer data, gint source, b_input_condition cond ); void root_command_string( irc_t *irc, user_t *u, char *command, int flags ); void root_command( irc_t *irc, char *command[] ); -void bitlbee_shutdown( gpointer data ); +gboolean bitlbee_shutdown( gpointer data, gint fd, b_input_condition cond ); extern global_t global; @@ -59,7 +59,7 @@ static void ipc_master_cmd_die( irc_t *data, char **cmd ) if( global.conf->runmode == RUNMODE_FORKDAEMON ) ipc_to_children_str( "DIE\r\n" ); - bitlbee_shutdown( NULL ); + bitlbee_shutdown( NULL, -1, 0 ); } void ipc_master_cmd_rehash( irc_t *data, char **cmd ) @@ -90,7 +90,7 @@ void ipc_master_cmd_restart( irc_t *data, char **cmd ) } global.restart = -1; - bitlbee_shutdown( NULL ); + bitlbee_shutdown( NULL, -1, 0 ); } static const command_t ipc_master_commands[] = { @@ -245,7 +245,7 @@ static char *ipc_readline( int fd ) return buf; } -void ipc_master_read( gpointer data, gint source, GaimInputCondition cond ) +gboolean ipc_master_read( gpointer data, gint source, b_input_condition cond ) { char *buf, **cmd; @@ -271,9 +271,11 @@ void ipc_master_read( gpointer data, gint source, GaimInputCondition cond ) } } } + + return TRUE; } -void ipc_child_read( gpointer data, gint source, GaimInputCondition cond ) +gboolean ipc_child_read( gpointer data, gint source, b_input_condition cond ) { char *buf, **cmd; @@ -285,11 +287,13 @@ void ipc_child_read( gpointer data, gint source, GaimInputCondition cond ) } else { - gaim_input_remove( global.listen_watch_source_id ); + b_event_remove( global.listen_watch_source_id ); close( global.listen_socket ); global.listen_socket = -1; } + + return TRUE; } void ipc_to_master( char **cmd ) @@ -396,7 +400,7 @@ void ipc_to_children_str( char *format, ... ) void ipc_master_free_one( struct bitlbee_child *c ) { - gaim_input_remove( c->ipc_inpa ); + b_event_remove( c->ipc_inpa ); closesocket( c->ipc_fd ); g_free( c->host ); @@ -462,7 +466,7 @@ void ipc_master_set_statefile( char *fn ) } -static void new_ipc_client( gpointer data, gint serversock, GaimInputCondition cond ) +static gboolean new_ipc_client( gpointer data, gint serversock, b_input_condition cond ) { struct bitlbee_child *child = g_new0( struct bitlbee_child, 1 ); @@ -471,12 +475,14 @@ static void new_ipc_client( gpointer data, gint serversock, GaimInputCondition c if( child->ipc_fd == -1 ) { log_message( LOGLVL_WARNING, "Unable to accept connection on UNIX domain socket: %s", strerror(errno) ); - return; + return TRUE; } - child->ipc_inpa = gaim_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child ); + child->ipc_inpa = b_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child ); child_list = g_slist_append( child_list, child ); + + return TRUE; } #ifndef _WIN32 @@ -511,7 +517,7 @@ int ipc_master_listen_socket() return 0; } - gaim_input_add( serversock, GAIM_INPUT_READ, new_ipc_client, NULL ); + b_input_add( serversock, GAIM_INPUT_READ, new_ipc_client, NULL ); return 1; } @@ -551,7 +557,7 @@ int ipc_master_load_state() fclose( fp ); return 0; } - child->ipc_inpa = gaim_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child ); + child->ipc_inpa = b_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child ); child_list = g_slist_append( child_list, child ); } @@ -39,8 +39,8 @@ struct bitlbee_child }; -void ipc_master_read( gpointer data, gint source, GaimInputCondition cond ); -void ipc_child_read( gpointer data, gint source, GaimInputCondition cond ); +gboolean ipc_master_read( gpointer data, gint source, b_input_condition cond ); +gboolean ipc_child_read( gpointer data, gint source, b_input_condition cond ); void ipc_master_free_one( struct bitlbee_child *child ); void ipc_master_free_all(); @@ -28,7 +28,7 @@ #include "crypting.h" #include "ipc.h" -static gboolean irc_userping( gpointer _irc ); +static gboolean irc_userping( gpointer _irc, int fd, b_input_condition cond ); GSList *irc_connection_list = NULL; @@ -55,7 +55,7 @@ irc_t *irc_new( int fd ) irc->fd = fd; sock_make_nonblocking( irc->fd ); - irc->r_watch_source_id = gaim_input_add( irc->fd, GAIM_INPUT_READ, bitlbee_io_current_client_read, irc ); + irc->r_watch_source_id = b_input_add( irc->fd, GAIM_INPUT_READ, bitlbee_io_current_client_read, irc ); irc->status = USTATUS_OFFLINE; irc->last_pong = gettime(); @@ -113,7 +113,7 @@ irc_t *irc_new( int fd ) if( !irc->myhost ) irc->myhost = g_strdup( "localhost." ); if( global.conf->ping_interval > 0 && global.conf->ping_timeout > 0 ) - irc->ping_source_id = g_timeout_add( global.conf->ping_interval * 1000, irc_userping, irc ); + irc->ping_source_id = b_timeout_add( global.conf->ping_interval * 1000, irc_userping, irc ); irc_write( irc, ":%s NOTICE AUTH :%s", irc->myhost, "BitlBee-IRCd initialized, please go on" ); @@ -183,8 +183,8 @@ void irc_abort( irc_t *irc, int immed, char *format, ... ) to it that should shut down the connection in a second, just in case bitlbee_.._write doesn't do it first. */ - g_source_remove( irc->r_watch_source_id ); - irc->r_watch_source_id = g_timeout_add_full( G_PRIORITY_HIGH, 1000, (GSourceFunc) irc_free, irc, NULL ); + b_event_remove( irc->r_watch_source_id ); + irc->r_watch_source_id = b_timeout_add( 1000, (b_event_handler) irc_free, irc ); } else { @@ -217,10 +217,10 @@ void irc_free(irc_t * irc) closesocket( irc->fd ); if( irc->ping_source_id > 0 ) - g_source_remove( irc->ping_source_id ); - g_source_remove( irc->r_watch_source_id ); + b_event_remove( irc->ping_source_id ); + b_event_remove( irc->r_watch_source_id ); if( irc->w_watch_source_id > 0 ) - g_source_remove( irc->w_watch_source_id ); + b_event_remove( irc->w_watch_source_id ); irc_connection_list = g_slist_remove( irc_connection_list, irc ); @@ -271,7 +271,7 @@ void irc_free(irc_t * irc) if(user->user!=user->nick) g_free(user->user); if(user->host!=user->nick) g_free(user->host); if(user->realname!=user->nick) g_free(user->realname); - gaim_input_remove(user->sendbuf_timer); + b_event_remove(user->sendbuf_timer); usertmp = user; user = user->next; @@ -321,7 +321,7 @@ void irc_free(irc_t * irc) g_free(irc); if( global.conf->runmode == RUNMODE_INETD || global.conf->runmode == RUNMODE_FORKDAEMON ) - g_main_quit( global.loop ); + b_main_quit(); } /* USE WITH CAUTION! @@ -604,7 +604,7 @@ void irc_vawrite( irc_t *irc, char *format, va_list params ) } if( irc->w_watch_source_id == 0 ) - irc->w_watch_source_id = gaim_input_add( irc->fd, GAIM_INPUT_WRITE, bitlbee_io_current_client_write, irc ); + irc->w_watch_source_id = b_input_add( irc->fd, GAIM_INPUT_WRITE, bitlbee_io_current_client_write, irc ); return; } @@ -1010,7 +1010,7 @@ int irc_send( irc_t *irc, char *nick, char *s, int flags ) return( 0 ); } -gboolean buddy_send_handler_delayed( gpointer data ) +static gboolean buddy_send_handler_delayed( gpointer data, gint fd, b_input_condition cond ) { user_t *u = data; @@ -1023,7 +1023,7 @@ gboolean buddy_send_handler_delayed( gpointer data ) u->sendbuf_timer = 0; u->sendbuf_flags = 0; - return( FALSE ); + return FALSE; } void buddy_send_handler( irc_t *irc, user_t *u, char *msg, int flags ) @@ -1037,8 +1037,8 @@ void buddy_send_handler( irc_t *irc, user_t *u, char *msg, int flags ) if( u->sendbuf_len > 0 && u->sendbuf_flags != flags) { //Flush the buffer - g_source_remove( u->sendbuf_timer ); - buddy_send_handler_delayed( u ); + b_event_remove( u->sendbuf_timer ); + buddy_send_handler_delayed( u, -1, 0 ); } if( u->sendbuf_len == 0 ) @@ -1062,8 +1062,8 @@ void buddy_send_handler( irc_t *irc, user_t *u, char *msg, int flags ) delay *= 1000; if( u->sendbuf_timer > 0 ) - g_source_remove( u->sendbuf_timer ); - u->sendbuf_timer = g_timeout_add( delay, buddy_send_handler_delayed, u ); + b_event_remove( u->sendbuf_timer ); + u->sendbuf_timer = b_timeout_add( delay, buddy_send_handler_delayed, u ); } else { @@ -1147,7 +1147,7 @@ int irc_noticefrom( irc_t *irc, char *nick, char *msg ) timeout. The number returned is the number of seconds we received no pongs from the user. When not connected yet, we don't ping but drop the connection when the user fails to connect in IRC_LOGIN_TIMEOUT secs. */ -static gboolean irc_userping( gpointer _irc ) +static gboolean irc_userping( gpointer _irc, gint fd, b_input_condition cond ) { irc_t *irc = _irc; int rv = 0; diff --git a/protocols/events.h b/protocols/events.h index 682a9c23..e8ac5a17 100644 --- a/protocols/events.h +++ b/protocols/events.h @@ -41,16 +41,20 @@ typedef enum { GAIM_INPUT_READ = 1 << 0, GAIM_INPUT_WRITE = 1 << 1 -} GaimInputCondition; -typedef void (*GaimInputFunction)(gpointer, gint, GaimInputCondition); +} b_input_condition; +typedef gboolean (*b_event_handler)(gpointer data, gint fd, b_input_condition cond); #define GAIM_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR) #define GAIM_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL) #define GAIM_ERR_COND (G_IO_HUP | G_IO_ERR | G_IO_NVAL) -G_MODULE_EXPORT gint gaim_input_add(int fd, GaimInputCondition cond, GaimInputFunction func, gpointer data); -G_MODULE_EXPORT void gaim_input_remove(gint id); +G_MODULE_EXPORT void b_main_init(); +G_MODULE_EXPORT void b_main_run(); +G_MODULE_EXPORT void b_main_quit(); -G_MODULE_EXPORT gint bee_timeout_add(gint timeout, GaimInputFunction func, gpointer data, gint priority); +G_MODULE_EXPORT gint b_input_add(int fd, b_input_condition cond, b_event_handler func, gpointer data); +G_MODULE_EXPORT gint b_timeout_add(gint timeout, b_event_handler func, gpointer data); +G_MODULE_EXPORT void b_event_remove(gint id); +G_MODULE_EXPORT gboolean b_event_remove_by_data(gpointer data); #endif /* _EVENTS_H_ */ diff --git a/protocols/events_glib.c b/protocols/events_glib.c index f3b27565..5a72b13c 100644 --- a/protocols/events_glib.c +++ b/protocols/events_glib.c @@ -46,24 +46,39 @@ #include "proxy.h" typedef struct _GaimIOClosure { - GaimInputFunction function; + b_event_handler function; guint result; gpointer data; } GaimIOClosure; +static GMainLoop *loop; + +void b_main_init() +{ + loop = g_main_new( FALSE ); +} + +void b_main_run() +{ + g_main_run( loop ); +} + +void b_main_quit() +{ + g_main_quit( loop ); +} + static gboolean gaim_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data) { GaimIOClosure *closure = data; - GaimInputCondition gaim_cond = 0; + b_input_condition gaim_cond = 0; if (condition & GAIM_READ_COND) gaim_cond |= GAIM_INPUT_READ; if (condition & GAIM_WRITE_COND) gaim_cond |= GAIM_INPUT_WRITE; - closure->function(closure->data, g_io_channel_unix_get_fd(source), gaim_cond); - - return TRUE; + return closure->function(closure->data, g_io_channel_unix_get_fd(source), gaim_cond); } static void gaim_io_destroy(gpointer data) @@ -71,7 +86,7 @@ static void gaim_io_destroy(gpointer data) g_free(data); } -gint gaim_input_add(gint source, GaimInputCondition condition, GaimInputFunction function, gpointer data) +gint b_input_add(gint source, b_input_condition condition, b_event_handler function, gpointer data) { GaimIOClosure *closure = g_new0(GaimIOClosure, 1); GIOChannel *channel; @@ -93,8 +108,18 @@ gint gaim_input_add(gint source, GaimInputCondition condition, GaimInputFunction return closure->result; } -void gaim_input_remove(gint tag) +gint b_timeout_add(gint timeout, b_event_handler func, gpointer data) +{ + return g_timeout_add(timeout, func, data); +} + +void b_event_remove(gint tag) { if (tag > 0) g_source_remove(tag); } + +gboolean b_event_remove_by_data(gpointer data) +{ + return g_source_remove_by_user_data(data); +} diff --git a/protocols/http_client.c b/protocols/http_client.c index 9417e200..0142bb2e 100644 --- a/protocols/http_client.c +++ b/protocols/http_client.c @@ -31,9 +31,9 @@ #include "sock.h" -static void http_connected( gpointer data, int source, GaimInputCondition cond ); -static void http_ssl_connected( gpointer data, void *source, GaimInputCondition cond ); -static void http_incoming_data( gpointer data, int source, GaimInputCondition cond ); +static gboolean http_connected( gpointer data, int source, b_input_condition cond ); +static gboolean http_ssl_connected( gpointer data, void *source, b_input_condition cond ); +static gboolean http_incoming_data( gpointer data, int source, b_input_condition cond ); void *http_dorequest( char *host, int port, int ssl, char *request, http_input_function func, gpointer data ) @@ -72,7 +72,7 @@ void *http_dorequest( char *host, int port, int ssl, char *request, http_input_f /* This one is actually pretty simple... Might get more calls if we can't write the whole request at once. */ -static void http_connected( gpointer data, int source, GaimInputCondition cond ) +static gboolean http_connected( gpointer data, int source, b_input_condition cond ) { struct http_request *req = data; int st; @@ -81,7 +81,7 @@ static void http_connected( gpointer data, int source, GaimInputCondition cond ) goto error; if( req->inpa > 0 ) - gaim_input_remove( req->inpa ); + b_event_remove( req->inpa ); sock_make_nonblocking( req->fd ); @@ -116,13 +116,13 @@ static void http_connected( gpointer data, int source, GaimInputCondition cond ) req->bytes_written += st; if( req->bytes_written < req->request_length ) - req->inpa = gaim_input_add( source, - req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_WRITE, - http_connected, req ); + req->inpa = b_input_add( source, + req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_WRITE, + http_connected, req ); else - req->inpa = gaim_input_add( source, GAIM_INPUT_READ, http_incoming_data, req ); + req->inpa = b_input_add( source, GAIM_INPUT_READ, http_incoming_data, req ); - return; + return FALSE; error: req->func( req ); @@ -130,10 +130,10 @@ error: g_free( req->request ); g_free( req ); - return; + return FALSE; } -static void http_ssl_connected( gpointer data, void *source, GaimInputCondition cond ) +static gboolean http_ssl_connected( gpointer data, void *source, b_input_condition cond ) { struct http_request *req = data; @@ -145,7 +145,7 @@ static void http_ssl_connected( gpointer data, void *source, GaimInputCondition return http_connected( data, req->fd, cond ); } -static void http_incoming_data( gpointer data, int source, GaimInputCondition cond ) +static gboolean http_incoming_data( gpointer data, int source, b_input_condition cond ) { struct http_request *req = data; int evil_server = 0; @@ -154,7 +154,7 @@ static void http_incoming_data( gpointer data, int source, GaimInputCondition co int st; if( req->inpa > 0 ) - gaim_input_remove( req->inpa ); + b_event_remove( req->inpa ); if( req->ssl ) { @@ -201,11 +201,11 @@ static void http_incoming_data( gpointer data, int source, GaimInputCondition co } /* There will be more! */ - req->inpa = gaim_input_add( req->fd, - req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_READ, - http_incoming_data, req ); + req->inpa = b_input_add( req->fd, + req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_READ, + http_incoming_data, req ); - return; + return FALSE; got_reply: /* Zero termination is very convenient. */ @@ -361,7 +361,7 @@ got_reply: req->bytes_read = req->bytes_written = req->inpa = 0; req->reply_headers = req->reply_body = NULL; - return; + return FALSE; } /* Assume that a closed connection means we're finished, this indeed @@ -379,4 +379,6 @@ cleanup: g_free( req->request ); g_free( req->reply_headers ); g_free( req ); + + return FALSE; } diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 54eed8a7..c9b7bc6e 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -470,12 +470,14 @@ static void endElement(void *userdata, const char *name) gjc->current = x; } -static void jabber_callback(gpointer data, gint source, GaimInputCondition condition) +static gboolean jabber_callback(gpointer data, gint source, b_input_condition condition) { struct gaim_connection *gc = (struct gaim_connection *)data; struct jabber_data *jd = (struct jabber_data *)gc->proto_data; gjab_recv(jd->gjc); + + return TRUE; } static void charData(void *userdata, const char *s, int slen) @@ -486,7 +488,7 @@ static void charData(void *userdata, const char *s, int slen) xmlnode_insert_cdata(gjc->current, s, slen); } -static void gjab_connected(gpointer data, gint source, GaimInputCondition cond) +static gboolean gjab_connected(gpointer data, gint source, b_input_condition cond) { xmlnode x; char *t, *t2; @@ -496,7 +498,7 @@ static void gjab_connected(gpointer data, gint source, GaimInputCondition cond) if (!g_slist_find(get_connections(), gc)) { closesocket(source); - return; + return FALSE; } jd = gc->proto_data; @@ -507,7 +509,7 @@ static void gjab_connected(gpointer data, gint source, GaimInputCondition cond) if (source == -1) { STATE_EVT(JCONN_STATE_OFF) - return; + return FALSE; } gjc->state = JCONN_STATE_CONNECTED; @@ -529,10 +531,12 @@ static void gjab_connected(gpointer data, gint source, GaimInputCondition cond) STATE_EVT(JCONN_STATE_ON); gc = GJ_GC(gjc); - gc->inpa = gaim_input_add(gjc->fd, GAIM_INPUT_READ, jabber_callback, gc); + gc->inpa = b_input_add(gjc->fd, GAIM_INPUT_READ, jabber_callback, gc); + + return FALSE; } -static void gjab_connected_ssl(gpointer data, void *source, GaimInputCondition cond) +static gboolean gjab_connected_ssl(gpointer data, void *source, b_input_condition cond) { struct gaim_connection *gc = data; struct jabber_data *jd; @@ -543,15 +547,15 @@ static void gjab_connected_ssl(gpointer data, void *source, GaimInputCondition c if (source == NULL) { STATE_EVT(JCONN_STATE_OFF) - return; + return FALSE; } if (!g_slist_find(get_connections(), gc)) { ssl_disconnect(source); - return; + return FALSE; } - gjab_connected(data, gjc->fd, cond); + return gjab_connected(data, gjc->fd, cond); } static void gjab_start(gjconn gjc) @@ -1542,7 +1546,7 @@ static gboolean jabber_destroy_hash(gpointer key, gpointer val, gpointer data) { return TRUE; } -static gboolean jabber_free(gpointer data) +static gboolean jabber_free(gpointer data, gint fd, b_input_condition cond) { struct jabber_data *jd = data; @@ -1585,10 +1589,10 @@ static void jabber_close(struct gaim_connection *gc) } } if (gc->inpa) - gaim_input_remove(gc->inpa); + b_event_remove(gc->inpa); if(jd) { - g_timeout_add(50, jabber_free, jd); + b_timeout_add(50, jabber_free, jd); if(jd->gjc != NULL) xmlnode_free(jd->gjc->current); } diff --git a/protocols/msn/msn.h b/protocols/msn/msn.h index 0cd174f2..dbbb6aa0 100644 --- a/protocols/msn/msn.h +++ b/protocols/msn/msn.h @@ -145,7 +145,7 @@ GSList *msn_connections; GSList *msn_switchboards; /* ns.c */ -void msn_ns_connected( gpointer data, gint source, GaimInputCondition cond ); +gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond ); /* msn_util.c */ int msn_write( struct gaim_connection *gc, char *s, int len ); @@ -172,4 +172,4 @@ struct msn_switchboard *msn_sb_spare( struct gaim_connection *gc ); int msn_sb_sendmessage( struct msn_switchboard *sb, char *text ); void msn_sb_to_chat( struct msn_switchboard *sb ); void msn_sb_destroy( struct msn_switchboard *sb ); -void msn_sb_connected( gpointer data, gint source, GaimInputCondition cond ); +gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond ); diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c index 90d525ef..af3793f2 100644 --- a/protocols/msn/ns.c +++ b/protocols/msn/ns.c @@ -29,26 +29,26 @@ #include "passport.h" #include "md5.h" -static void msn_ns_callback( gpointer data, gint source, GaimInputCondition cond ); +static gboolean msn_ns_callback( gpointer data, gint source, b_input_condition cond ); static int msn_ns_command( gpointer data, char **cmd, int num_parts ); static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int num_parts ); static void msn_auth_got_passport_id( struct passport_reply *rep ); -void msn_ns_connected( gpointer data, gint source, GaimInputCondition cond ) +gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond ) { struct gaim_connection *gc = data; struct msn_data *md; char s[1024]; if( !g_slist_find( msn_connections, gc ) ) - return; + return FALSE; if( source == -1 ) { hide_login_progress( gc, "Could not connect to server" ); signoff( gc ); - return; + return FALSE; } md = gc->proto_data; @@ -74,12 +74,14 @@ void msn_ns_connected( gpointer data, gint source, GaimInputCondition cond ) g_snprintf( s, sizeof( s ), "VER %d MSNP8 CVR0\r\n", ++md->trId ); if( msn_write( gc, s, strlen( s ) ) ) { - gc->inpa = gaim_input_add( md->fd, GAIM_INPUT_READ, msn_ns_callback, gc ); + gc->inpa = b_input_add( md->fd, GAIM_INPUT_READ, msn_ns_callback, gc ); set_login_progress( gc, 1, "Connected to server, waiting for reply" ); } + + return FALSE; } -void msn_ns_callback( gpointer data, gint source, GaimInputCondition cond ) +static gboolean msn_ns_callback( gpointer data, gint source, b_input_condition cond ) { struct gaim_connection *gc = data; struct msn_data *md = gc->proto_data; @@ -88,7 +90,11 @@ void msn_ns_callback( gpointer data, gint source, GaimInputCondition cond ) { hide_login_progress( gc, "Error while reading from server" ); signoff( gc ); + + return FALSE; } + else + return TRUE; } static int msn_ns_command( gpointer data, char **cmd, int num_parts ) @@ -129,7 +135,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) if( num_parts == 6 && strcmp( cmd[2], "NS" ) == 0 ) { - gaim_input_remove( gc->inpa ); + b_event_remove( gc->inpa ); gc->inpa = 0; closesocket( md->fd ); diff --git a/protocols/msn/sb.c b/protocols/msn/sb.c index 234be1d6..54e89043 100644 --- a/protocols/msn/sb.c +++ b/protocols/msn/sb.c @@ -29,7 +29,7 @@ #include "passport.h" #include "md5.h" -static void msn_sb_callback( gpointer data, gint source, GaimInputCondition cond ); +static gboolean msn_sb_callback( gpointer data, gint source, b_input_condition cond ); static int msn_sb_command( gpointer data, char **cmd, int num_parts ); static int msn_sb_message( gpointer data, char *msg, int msglen, char **cmd, int num_parts ); @@ -236,7 +236,7 @@ void msn_sb_destroy( struct msn_switchboard *sb ) g_free( sb->handler ); } - if( sb->inp ) gaim_input_remove( sb->inp ); + if( sb->inp ) b_event_remove( sb->inp ); closesocket( sb->fd ); msn_switchboards = g_slist_remove( msn_switchboards, sb ); @@ -244,7 +244,7 @@ void msn_sb_destroy( struct msn_switchboard *sb ) g_free( sb ); } -void msn_sb_connected( gpointer data, gint source, GaimInputCondition cond ) +gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond ) { struct msn_switchboard *sb = data; struct gaim_connection *gc; @@ -253,7 +253,7 @@ void msn_sb_connected( gpointer data, gint source, GaimInputCondition cond ) /* Are we still alive? */ if( !g_slist_find( msn_switchboards, sb ) ) - return; + return FALSE; gc = sb->gc; md = gc->proto_data; @@ -262,7 +262,7 @@ void msn_sb_connected( gpointer data, gint source, GaimInputCondition cond ) { debug( "ERROR %d while connecting to switchboard server", 1 ); msn_sb_destroy( sb ); - return; + return FALSE; } /* Prepare the callback */ @@ -279,12 +279,14 @@ void msn_sb_connected( gpointer data, gint source, GaimInputCondition cond ) g_snprintf( buf, sizeof( buf ), "ANS %d %s %s %d\r\n", ++sb->trId, gc->username, sb->key, sb->session ); if( msn_sb_write( sb, buf, strlen( buf ) ) ) - sb->inp = gaim_input_add( sb->fd, GAIM_INPUT_READ, msn_sb_callback, sb ); + sb->inp = b_input_add( sb->fd, GAIM_INPUT_READ, msn_sb_callback, sb ); else debug( "ERROR %d while connecting to switchboard server", 2 ); + + return FALSE; } -static void msn_sb_callback( gpointer data, gint source, GaimInputCondition cond ) +static gboolean msn_sb_callback( gpointer data, gint source, b_input_condition cond ) { struct msn_switchboard *sb = data; @@ -292,7 +294,11 @@ static void msn_sb_callback( gpointer data, gint source, GaimInputCondition cond { debug( "ERROR: Switchboard died" ); msn_sb_destroy( sb ); + + return FALSE; } + else + return TRUE; } static int msn_sb_command( gpointer data, char **cmd, int num_parts ) diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 4c2a3bb4..c3d810a3 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -327,7 +327,7 @@ void serv_got_crap( struct gaim_connection *gc, char *format, ... ) g_free( text ); } -static gboolean send_keepalive( gpointer d ) +static gboolean send_keepalive( gpointer d, gint fd, b_input_condition cond ) { struct gaim_connection *gc = d; @@ -351,7 +351,7 @@ void account_online( struct gaim_connection *gc ) serv_got_crap( gc, "Logged in" ); - gc->keepalive = g_timeout_add( 60000, send_keepalive, gc ); + gc->keepalive = b_timeout_add( 60000, send_keepalive, gc ); gc->flags |= OPT_LOGGED_IN; /* Also necessary when we're not away, at least for some of the @@ -359,7 +359,7 @@ void account_online( struct gaim_connection *gc ) proto_away( gc, u->away ); } -gboolean auto_reconnect( gpointer data ) +gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond ) { account_t *a = data; @@ -371,7 +371,7 @@ gboolean auto_reconnect( gpointer data ) void cancel_auto_reconnect( account_t *a ) { - while( g_source_remove_by_user_data( (gpointer) a ) ); + while( b_event_remove_by_data( (gpointer) a ) ); a->reconnect = 0; } @@ -383,10 +383,10 @@ void signoff( struct gaim_connection *gc ) serv_got_crap( gc, "Signing off.." ); - gaim_input_remove( gc->keepalive ); + b_event_remove( gc->keepalive ); gc->keepalive = 0; gc->prpl->close( gc ); - gaim_input_remove( gc->inpa ); + b_event_remove( gc->inpa ); while( u ) { @@ -416,7 +416,7 @@ void signoff( struct gaim_connection *gc ) serv_got_crap( gc, "Reconnecting in %d seconds..", delay ); a->reconnect = 1; - g_timeout_add( delay * 1000, auto_reconnect, a ); + b_timeout_add( delay * 1000, auto_reconnect, a ); } destroy_gaim_conn( gc ); diff --git a/protocols/nogaim.h b/protocols/nogaim.h index 4251fbaa..3f88a9ef 100644 --- a/protocols/nogaim.h +++ b/protocols/nogaim.h @@ -200,7 +200,7 @@ void nogaim_init(); int proto_away( struct gaim_connection *gc, char *away ); char *set_eval_away_devoice( irc_t *irc, set_t *set, char *value ); -gboolean auto_reconnect( gpointer data ); +gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond ); void cancel_auto_reconnect( struct account *a ); /* multi.c */ diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 53da1e27..ca3210ef 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -252,8 +252,8 @@ static char *msgerrreason[] = { }; static int msgerrreasonlen = 25; -static void oscar_callback(gpointer data, gint source, - GaimInputCondition condition) { +static gboolean oscar_callback(gpointer data, gint source, + b_input_condition condition) { aim_conn_t *conn = (aim_conn_t *)data; aim_session_t *sess = aim_conn_getsess(conn); struct gaim_connection *gc = sess ? sess->aux_data : NULL; @@ -261,13 +261,13 @@ static void oscar_callback(gpointer data, gint source, if (!gc) { /* gc is null. we return, else we seg SIGSEG on next line. */ - return; + return FALSE; } if (!g_slist_find(get_connections(), gc)) { /* oh boy. this is probably bad. i guess the only thing we * can really do is return? */ - return; + return FALSE; } odata = (struct oscar_data *)gc->proto_data; @@ -287,7 +287,7 @@ static void oscar_callback(gpointer data, gint source, char buf[BUF_LONG]; c->conn = NULL; if (c->inpa > 0) - gaim_input_remove(c->inpa); + b_event_remove(c->inpa); c->inpa = 0; c->fd = -1; aim_conn_kill(odata->sess, &conn); @@ -295,7 +295,7 @@ static void oscar_callback(gpointer data, gint source, do_error_dialog(sess->aux_data, buf, _("Chat Error!")); } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { if (odata->cnpa > 0) - gaim_input_remove(odata->cnpa); + b_event_remove(odata->cnpa); odata->cnpa = 0; while (odata->create_rooms) { struct create_room *cr = odata->create_rooms->data; @@ -309,17 +309,22 @@ static void oscar_callback(gpointer data, gint source, aim_conn_kill(odata->sess, &conn); } else if (conn->type == AIM_CONN_TYPE_AUTH) { if (odata->paspa > 0) - gaim_input_remove(odata->paspa); + b_event_remove(odata->paspa); odata->paspa = 0; aim_conn_kill(odata->sess, &conn); } else { aim_conn_kill(odata->sess, &conn); } } + } else { + /* WTF??? */ + return FALSE; } + + return TRUE; } -static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) +static gboolean oscar_login_connect(gpointer data, gint source, b_input_condition cond) { struct gaim_connection *gc = data; struct oscar_data *odata; @@ -328,7 +333,7 @@ static void oscar_login_connect(gpointer data, gint source, GaimInputCondition c if (!g_slist_find(get_connections(), gc)) { closesocket(source); - return; + return FALSE; } odata = gc->proto_data; @@ -338,12 +343,14 @@ static void oscar_login_connect(gpointer data, gint source, GaimInputCondition c if (source < 0) { hide_login_progress(gc, _("Couldn't connect to host")); signoff(gc); - return; + return FALSE; } aim_conn_completeconnect(sess, conn); - gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, + gc->inpa = b_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn); + + return FALSE; } static void oscar_login(struct aim_user *user) { @@ -411,7 +418,7 @@ static void oscar_close(struct gaim_connection *gc) { while (odata->oscar_chats) { struct chat_connection *n = odata->oscar_chats->data; if (n->inpa > 0) - gaim_input_remove(n->inpa); + b_event_remove(n->inpa); g_free(n->name); g_free(n->show); odata->oscar_chats = g_slist_remove(odata->oscar_chats, n); @@ -430,11 +437,11 @@ static void oscar_close(struct gaim_connection *gc) { if (odata->oldp) g_free(odata->oldp); if (gc->inpa > 0) - gaim_input_remove(gc->inpa); + b_event_remove(gc->inpa); if (odata->cnpa > 0) - gaim_input_remove(odata->cnpa); + b_event_remove(odata->cnpa); if (odata->paspa > 0) - gaim_input_remove(odata->paspa); + b_event_remove(odata->paspa); aim_session_kill(odata->sess); g_free(odata->sess); odata->sess = NULL; @@ -442,7 +449,7 @@ static void oscar_close(struct gaim_connection *gc) { gc->proto_data = NULL; } -static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { +static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition cond) { struct gaim_connection *gc = data; struct oscar_data *odata; aim_session_t *sess; @@ -450,7 +457,7 @@ static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition con if (!g_slist_find(get_connections(), gc)) { closesocket(source); - return; + return FALSE; } odata = gc->proto_data; @@ -460,13 +467,15 @@ static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition con if (source < 0) { hide_login_progress(gc, _("Could Not Connect")); signoff(gc); - return; + return FALSE; } aim_conn_completeconnect(sess, bosconn); - gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ, + gc->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ, oscar_callback, bosconn); set_login_progress(gc, 4, _("Connection established, cookie sent")); + + return FALSE; } static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { @@ -569,7 +578,7 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { return 0; } aim_sendcookie(sess, bosconn, info->cookie); - gaim_input_remove(gc->inpa); + b_event_remove(gc->inpa); return 1; } @@ -584,7 +593,7 @@ struct pieceofcrap { unsigned int inpa; }; -static void damn_you(gpointer data, gint source, GaimInputCondition c) +static gboolean damn_you(gpointer data, gint source, b_input_condition c) { struct pieceofcrap *pos = data; struct oscar_data *od = pos->gc->proto_data; @@ -604,21 +613,23 @@ static void damn_you(gpointer data, gint source, GaimInputCondition c) if (in != '\n') { do_error_dialog(pos->gc, "Gaim was unable to get a valid hash for logging into AIM." " You may be disconnected shortly.", "Login Error"); - gaim_input_remove(pos->inpa); + b_event_remove(pos->inpa); closesocket(pos->fd); g_free(pos); - return; + return FALSE; } /* [WvG] Wheeeee! Who needs error checking anyway? ;-) */ read(pos->fd, m, 16); m[16] = '\0'; - gaim_input_remove(pos->inpa); + b_event_remove(pos->inpa); closesocket(pos->fd); aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); g_free(pos); + + return FALSE; } -static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) { +static gboolean straight_to_hell(gpointer data, gint source, b_input_condition cond) { struct pieceofcrap *pos = data; char buf[BUF_LONG]; @@ -628,7 +639,7 @@ static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond if (pos->modname) g_free(pos->modname); g_free(pos); - return; + return FALSE; } g_snprintf(buf, sizeof(buf), "GET " AIMHASHDATA @@ -637,8 +648,8 @@ static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond write(pos->fd, buf, strlen(buf)); if (pos->modname) g_free(pos->modname); - pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos); - return; + pos->inpa = b_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos); + return FALSE; } /* size of icbmui.ocm, the largest module in AIM 3.5 */ @@ -760,7 +771,7 @@ static int conninitdone_chatnav(aim_session_t *sess, aim_frame_t *fr, ...) { return 1; } -static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) { +static gboolean oscar_chatnav_connect(gpointer data, gint source, b_input_condition cond) { struct gaim_connection *gc = data; struct oscar_data *odata; aim_session_t *sess; @@ -768,7 +779,7 @@ static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition if (!g_slist_find(get_connections(), gc)) { closesocket(source); - return; + return FALSE; } odata = gc->proto_data; @@ -777,15 +788,17 @@ static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition if (source < 0) { aim_conn_kill(sess, &tstconn); - return; + return FALSE; } aim_conn_completeconnect(sess, tstconn); - odata->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, + odata->cnpa = b_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); + + return FALSE; } -static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) +static gboolean oscar_auth_connect(gpointer data, gint source, b_input_condition cond) { struct gaim_connection *gc = data; struct oscar_data *odata; @@ -794,7 +807,7 @@ static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition co if (!g_slist_find(get_connections(), gc)) { closesocket(source); - return; + return FALSE; } odata = gc->proto_data; @@ -803,15 +816,17 @@ static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition co if (source < 0) { aim_conn_kill(sess, &tstconn); - return; + return FALSE; } aim_conn_completeconnect(sess, tstconn); - odata->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, + odata->paspa = b_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); + + return FALSE; } -static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) +static gboolean oscar_chat_connect(gpointer data, gint source, b_input_condition cond) { struct chat_connection *ccon = data; struct gaim_connection *gc = ccon->gc; @@ -824,7 +839,7 @@ static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition co g_free(ccon->show); g_free(ccon->name); g_free(ccon); - return; + return FALSE; } odata = gc->proto_data; @@ -836,14 +851,16 @@ static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition co g_free(ccon->show); g_free(ccon->name); g_free(ccon); - return; + return FALSE; } aim_conn_completeconnect(sess, ccon->conn); - ccon->inpa = gaim_input_add(tstconn->fd, + ccon->inpa = b_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon); + + return FALSE; } /* Hrmph. I don't know how to make this look better. --mid */ @@ -2557,7 +2574,7 @@ void oscar_chat_kill(struct gaim_connection *gc, struct chat_connection *cc) /* Destroy the chat_connection */ od->oscar_chats = g_slist_remove(od->oscar_chats, cc); if (cc->inpa > 0) - gaim_input_remove(cc->inpa); + b_event_remove(cc->inpa); aim_conn_kill(od->sess, &cc->conn); g_free(cc->name); g_free(cc->show); diff --git a/protocols/proxy.c b/protocols/proxy.c index 57d804c6..d6f3a4ca 100644 --- a/protocols/proxy.c +++ b/protocols/proxy.c @@ -48,7 +48,7 @@ char proxyuser[128] = ""; char proxypass[128] = ""; struct PHB { - GaimInputFunction func, proxy_func; + b_event_handler func, proxy_func; gpointer data, proxy_data; char *host; int port; @@ -77,7 +77,7 @@ static struct sockaddr_in *gaim_gethostbyname(const char *host, int port) return &sin; } -static void gaim_io_connected(gpointer data, gint source, GaimInputCondition cond) +static gboolean gaim_io_connected(gpointer data, gint source, b_input_condition cond) { struct PHB *phb = data; unsigned int len; @@ -87,24 +87,26 @@ static void gaim_io_connected(gpointer data, gint source, GaimInputCondition con #ifndef _WIN32 if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { closesocket(source); - gaim_input_remove(phb->inpa); + b_event_remove(phb->inpa); if( phb->proxy_func ) phb->proxy_func(phb->proxy_data, -1, GAIM_INPUT_READ); else { phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb); } - return; + return FALSE; } #endif sock_make_blocking(source); - gaim_input_remove(phb->inpa); + b_event_remove(phb->inpa); if( phb->proxy_func ) phb->proxy_func(phb->proxy_data, source, GAIM_INPUT_READ); else { phb->func(phb->data, source, GAIM_INPUT_READ); g_free(phb); } + + return FALSE; } static int proxy_connect_none(const char *host, unsigned short port, struct PHB *phb) @@ -126,7 +128,7 @@ static int proxy_connect_none(const char *host, unsigned short port, struct PHB if (connect(fd, (struct sockaddr *)sin, sizeof(*sin)) < 0) { if (sockerr_again()) { - phb->inpa = gaim_input_add(fd, GAIM_INPUT_WRITE, gaim_io_connected, phb); + phb->inpa = b_input_add(fd, GAIM_INPUT_WRITE, gaim_io_connected, phb); phb->fd = fd; } else { closesocket(fd); @@ -144,14 +146,14 @@ static int proxy_connect_none(const char *host, unsigned short port, struct PHB #define HTTP_GOODSTRING "HTTP/1.0 200 Connection established" #define HTTP_GOODSTRING2 "HTTP/1.1 200 Connection established" -static void http_canread(gpointer data, gint source, GaimInputCondition cond) +static gboolean http_canread(gpointer data, gint source, b_input_condition cond) { int nlc = 0; int pos = 0; struct PHB *phb = data; char inputline[8192]; - gaim_input_remove(phb->inpa); + b_event_remove(phb->inpa); while ((pos < sizeof(inputline)-1) && (nlc != 2) && (read(source, &inputline[pos++], 1) == 1)) { if (inputline[pos - 1] == '\n') @@ -166,31 +168,32 @@ static void http_canread(gpointer data, gint source, GaimInputCondition cond) phb->func(phb->data, source, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); - return; + return FALSE; } close(source); phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); - return; + + return FALSE; } -static void http_canwrite(gpointer data, gint source, GaimInputCondition cond) +static gboolean http_canwrite(gpointer data, gint source, b_input_condition cond) { char cmd[384]; struct PHB *phb = data; unsigned int len; int error = ETIMEDOUT; if (phb->inpa > 0) - gaim_input_remove(phb->inpa); + b_event_remove(phb->inpa); len = sizeof(error); if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { close(source); phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); - return; + return FALSE; } sock_make_blocking(source); @@ -201,7 +204,7 @@ static void http_canwrite(gpointer data, gint source, GaimInputCondition cond) phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); - return; + return FALSE; } if (proxyuser && *proxyuser) { @@ -216,7 +219,7 @@ static void http_canwrite(gpointer data, gint source, GaimInputCondition cond) phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); - return; + return FALSE; } } @@ -226,10 +229,12 @@ static void http_canwrite(gpointer data, gint source, GaimInputCondition cond) phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); - return; + return FALSE; } - phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, http_canread, phb); + phb->inpa = b_input_add(source, GAIM_INPUT_READ, http_canread, phb); + + return FALSE; } static int proxy_connect_http(const char *host, unsigned short port, struct PHB *phb) @@ -245,28 +250,30 @@ static int proxy_connect_http(const char *host, unsigned short port, struct PHB /* Connecting to SOCKS4 proxies */ -static void s4_canread(gpointer data, gint source, GaimInputCondition cond) +static gboolean s4_canread(gpointer data, gint source, b_input_condition cond) { unsigned char packet[12]; struct PHB *phb = data; - gaim_input_remove(phb->inpa); + b_event_remove(phb->inpa); memset(packet, 0, sizeof(packet)); if (read(source, packet, 9) >= 4 && packet[1] == 90) { phb->func(phb->data, source, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); - return; + return FALSE; } close(source); phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); + + return FALSE; } -static void s4_canwrite(gpointer data, gint source, GaimInputCondition cond) +static gboolean s4_canwrite(gpointer data, gint source, b_input_condition cond) { unsigned char packet[12]; struct hostent *hp; @@ -274,14 +281,14 @@ static void s4_canwrite(gpointer data, gint source, GaimInputCondition cond) unsigned int len; int error = ETIMEDOUT; if (phb->inpa > 0) - gaim_input_remove(phb->inpa); + b_event_remove(phb->inpa); len = sizeof(error); if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { close(source); phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); - return; + return FALSE; } sock_make_blocking(source); @@ -291,7 +298,7 @@ static void s4_canwrite(gpointer data, gint source, GaimInputCondition cond) phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); - return; + return FALSE; } packet[0] = 4; @@ -308,10 +315,12 @@ static void s4_canwrite(gpointer data, gint source, GaimInputCondition cond) phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); - return; + return FALSE; } - phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, s4_canread, phb); + phb->inpa = b_input_add(source, GAIM_INPUT_READ, s4_canread, phb); + + return FALSE; } static int proxy_connect_socks4(const char *host, unsigned short port, struct PHB *phb) @@ -327,32 +336,33 @@ static int proxy_connect_socks4(const char *host, unsigned short port, struct PH /* Connecting to SOCKS5 proxies */ -static void s5_canread_again(gpointer data, gint source, GaimInputCondition cond) +static gboolean s5_canread_again(gpointer data, gint source, b_input_condition cond) { unsigned char buf[512]; struct PHB *phb = data; - gaim_input_remove(phb->inpa); + b_event_remove(phb->inpa); if (read(source, buf, 10) < 10) { close(source); phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); - return; + return FALSE; } if ((buf[0] != 0x05) || (buf[1] != 0x00)) { close(source); phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); - return; + return FALSE; } phb->func(phb->data, source, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); - return; + + return FALSE; } static void s5_sendconnect(gpointer data, gint source) @@ -360,7 +370,7 @@ static void s5_sendconnect(gpointer data, gint source) unsigned char buf[512]; struct PHB *phb = data; int hlen = strlen(phb->host); - + buf[0] = 0x05; buf[1] = 0x01; /* CONNECT */ buf[2] = 0x00; /* reserved */ @@ -378,22 +388,22 @@ static void s5_sendconnect(gpointer data, gint source) return; } - phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, s5_canread_again, phb); + phb->inpa = b_input_add(source, GAIM_INPUT_READ, s5_canread_again, phb); } -static void s5_readauth(gpointer data, gint source, GaimInputCondition cond) +static gboolean s5_readauth(gpointer data, gint source, b_input_condition cond) { unsigned char buf[512]; struct PHB *phb = data; - gaim_input_remove(phb->inpa); + b_event_remove(phb->inpa); if (read(source, buf, 2) < 2) { close(source); phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); - return; + return FALSE; } if ((buf[0] != 0x01) || (buf[1] != 0x00)) { @@ -401,25 +411,27 @@ static void s5_readauth(gpointer data, gint source, GaimInputCondition cond) phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); - return; + return FALSE; } s5_sendconnect(phb, source); + + return FALSE; } -static void s5_canread(gpointer data, gint source, GaimInputCondition cond) +static gboolean s5_canread(gpointer data, gint source, b_input_condition cond) { unsigned char buf[512]; struct PHB *phb = data; - gaim_input_remove(phb->inpa); + b_event_remove(phb->inpa); if (read(source, buf, 2) < 2) { close(source); phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); - return; + return FALSE; } if ((buf[0] != 0x05) || (buf[1] == 0xff)) { @@ -427,7 +439,7 @@ static void s5_canread(gpointer data, gint source, GaimInputCondition cond) phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); - return; + return FALSE; } if (buf[1] == 0x02) { @@ -442,16 +454,18 @@ static void s5_canread(gpointer data, gint source, GaimInputCondition cond) phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); - return; + return FALSE; } - phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, s5_readauth, phb); + phb->inpa = b_input_add(source, GAIM_INPUT_READ, s5_readauth, phb); } else { s5_sendconnect(phb, source); } + + return FALSE; } -static void s5_canwrite(gpointer data, gint source, GaimInputCondition cond) +static gboolean s5_canwrite(gpointer data, gint source, b_input_condition cond) { unsigned char buf[512]; int i; @@ -459,14 +473,14 @@ static void s5_canwrite(gpointer data, gint source, GaimInputCondition cond) unsigned int len; int error = ETIMEDOUT; if (phb->inpa > 0) - gaim_input_remove(phb->inpa); + b_event_remove(phb->inpa); len = sizeof(error); if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { close(source); phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); - return; + return FALSE; } sock_make_blocking(source); @@ -488,10 +502,12 @@ static void s5_canwrite(gpointer data, gint source, GaimInputCondition cond) phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); - return; + return FALSE; } - phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, s5_canread, phb); + phb->inpa = b_input_add(source, GAIM_INPUT_READ, s5_canread, phb); + + return FALSE; } static int proxy_connect_socks5(const char *host, unsigned short port, struct PHB *phb) @@ -507,7 +523,7 @@ static int proxy_connect_socks5(const char *host, unsigned short port, struct PH /* Export functions */ -int proxy_connect(const char *host, int port, GaimInputFunction func, gpointer data) +int proxy_connect(const char *host, int port, b_event_handler func, gpointer data) { struct PHB *phb; diff --git a/protocols/proxy.h b/protocols/proxy.h index 7094b334..680790a5 100644 --- a/protocols/proxy.h +++ b/protocols/proxy.h @@ -48,6 +48,6 @@ extern int proxytype; extern char proxyuser[128]; extern char proxypass[128]; -G_MODULE_EXPORT int proxy_connect(const char *host, int port, GaimInputFunction func, gpointer data); +G_MODULE_EXPORT int proxy_connect(const char *host, int port, b_event_handler func, gpointer data); #endif /* _PROXY_H_ */ diff --git a/protocols/ssl_bogus.c b/protocols/ssl_bogus.c index 52406b75..00aaa7c4 100644 --- a/protocols/ssl_bogus.c +++ b/protocols/ssl_bogus.c @@ -51,7 +51,7 @@ int ssl_getfd( void *conn ) return( -1 ); } -GaimInputCondition ssl_getdirection( void *conn ) +b_input_condition ssl_getdirection( void *conn ) { return GAIM_INPUT_READ; } diff --git a/protocols/ssl_client.h b/protocols/ssl_client.h index 89189db9..1a9c79e9 100644 --- a/protocols/ssl_client.h +++ b/protocols/ssl_client.h @@ -32,11 +32,11 @@ extern int ssl_errno; -typedef void (*ssl_input_function)(gpointer, void*, GaimInputCondition); +typedef gboolean (*ssl_input_function)(gpointer, void*, b_input_condition); G_MODULE_EXPORT void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data ); G_MODULE_EXPORT int ssl_read( void *conn, char *buf, int len ); G_MODULE_EXPORT int ssl_write( void *conn, const char *buf, int len ); G_MODULE_EXPORT void ssl_disconnect( void *conn_ ); G_MODULE_EXPORT int ssl_getfd( void *conn ); -G_MODULE_EXPORT GaimInputCondition ssl_getdirection( void *conn ); +G_MODULE_EXPORT b_input_condition ssl_getdirection( void *conn ); diff --git a/protocols/ssl_gnutls.c b/protocols/ssl_gnutls.c index f2cb3e08..024dc423 100644 --- a/protocols/ssl_gnutls.c +++ b/protocols/ssl_gnutls.c @@ -47,7 +47,7 @@ struct scd gnutls_certificate_credentials xcred; }; -static void ssl_connected( gpointer data, gint source, GaimInputCondition cond ); +static void ssl_connected( gpointer data, gint source, b_input_condition cond ); void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data ) @@ -80,9 +80,9 @@ void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data return( conn ); } -static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond ); +static void ssl_handshake( gpointer data, gint source, b_input_condition cond ); -static void ssl_connected( gpointer data, gint source, GaimInputCondition cond ) +static void ssl_connected( gpointer data, gint source, b_input_condition cond ) { struct scd *conn = data; @@ -104,7 +104,7 @@ static void ssl_connected( gpointer data, gint source, GaimInputCondition cond ) ssl_handshake( data, source, cond ); } -static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond ) +static void ssl_handshake( gpointer data, gint source, b_input_condition cond ) { struct scd *conn = data; int st; @@ -203,7 +203,7 @@ int ssl_getfd( void *conn ) return( ((struct scd*)conn)->fd ); } -GaimInputCondition ssl_getdirection( void *conn ) +b_input_condition ssl_getdirection( void *conn ) { return( gnutls_record_get_direction( ((struct scd*)conn)->session ) ? GAIM_INPUT_WRITE : GAIM_INPUT_READ ); diff --git a/protocols/ssl_nss.c b/protocols/ssl_nss.c index 00d32834..218b3a80 100644 --- a/protocols/ssl_nss.c +++ b/protocols/ssl_nss.c @@ -51,7 +51,7 @@ struct scd gboolean established; }; -static void ssl_connected( gpointer data, gint source, GaimInputCondition cond ); +static gboolean ssl_connected( gpointer data, gint source, b_input_condition cond ); static SECStatus nss_auth_cert (void *arg, PRFileDesc *socket, PRBool checksig, PRBool isserver) @@ -115,7 +115,7 @@ void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data return( conn ); } -static void ssl_connected( gpointer data, gint source, GaimInputCondition cond ) +static gboolean ssl_connected( gpointer data, gint source, b_input_condition cond ) { struct scd *conn = data; @@ -139,7 +139,7 @@ static void ssl_connected( gpointer data, gint source, GaimInputCondition cond ) conn->established = TRUE; conn->func( conn->data, conn, cond ); - return; + return FALSE; ssl_connected_failure: @@ -148,6 +148,8 @@ static void ssl_connected( gpointer data, gint source, GaimInputCondition cond ) PR_Close( conn -> prfd ); if( source >= 0 ) closesocket( source ); g_free( conn ); + + return FALSE; } int ssl_read( void *conn, char *buf, int len ) @@ -181,7 +183,7 @@ int ssl_getfd( void *conn ) return( ((struct scd*)conn)->fd ); } -GaimInputCondition ssl_getdirection( void *conn ) +b_input_condition ssl_getdirection( void *conn ) { /* Just in case someone calls us, let's return the most likely case: */ return GAIM_INPUT_READ; diff --git a/protocols/ssl_openssl.c b/protocols/ssl_openssl.c index b79088cc..df4aea2b 100644 --- a/protocols/ssl_openssl.c +++ b/protocols/ssl_openssl.c @@ -51,7 +51,7 @@ struct scd SSL_CTX *ssl_ctx; }; -static void ssl_connected( gpointer data, gint source, GaimInputCondition cond ); +static void ssl_connected( gpointer data, gint source, b_input_condition cond ); @@ -94,9 +94,9 @@ void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data return( conn ); } -static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond ); +static void ssl_handshake( gpointer data, gint source, b_input_condition cond ); -static void ssl_connected( gpointer data, gint source, GaimInputCondition cond ) +static void ssl_connected( gpointer data, gint source, b_input_condition cond ) { struct scd *conn = data; @@ -110,7 +110,7 @@ static void ssl_connected( gpointer data, gint source, GaimInputCondition cond ) return ssl_handshake( data, source, cond ); } -static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond ) +static void ssl_handshake( gpointer data, gint source, b_input_condition cond ) { struct scd *conn = data; int st; @@ -220,7 +220,7 @@ int ssl_getfd( void *conn ) return( ((struct scd*)conn)->fd ); } -GaimInputCondition ssl_getdirection( void *conn ) +b_input_condition ssl_getdirection( void *conn ) { return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? GAIM_INPUT_WRITE : GAIM_INPUT_READ ); } diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c index bf1dd1a0..1ce860eb 100644 --- a/protocols/yahoo/yahoo.c +++ b/protocols/yahoo/yahoo.c @@ -442,7 +442,7 @@ struct byahoo_connect_callback_data int id; }; -void byahoo_connect_callback( gpointer data, gint source, GaimInputCondition cond ) +void byahoo_connect_callback( gpointer data, gint source, b_input_condition cond ) { struct byahoo_connect_callback_data *d = data; @@ -464,7 +464,7 @@ struct byahoo_read_ready_data gpointer data; }; -void byahoo_read_ready_callback( gpointer data, gint source, GaimInputCondition cond ) +gboolean byahoo_read_ready_callback( gpointer data, gint source, b_input_condition cond ) { struct byahoo_read_ready_data *d = data; @@ -472,7 +472,7 @@ void byahoo_read_ready_callback( gpointer data, gint source, GaimInputCondition { /* WTF doesn't libyahoo clean this up? */ ext_yahoo_remove_handler( d->id, d->tag ); - return; + return FALSE; } yahoo_read_ready( d->id, d->fd, d->data ); @@ -486,7 +486,7 @@ struct byahoo_write_ready_data gpointer data; }; -void byahoo_write_ready_callback( gpointer data, gint source, GaimInputCondition cond ) +gboolean byahoo_write_ready_callback( gpointer data, gint source, b_input_condition cond ) { struct byahoo_write_ready_data *d = data; @@ -494,7 +494,7 @@ void byahoo_write_ready_callback( gpointer data, gint source, GaimInputCondition { /* WTF doesn't libyahoo clean this up? */ ext_yahoo_remove_handler( d->id, d->tag ); - return; + return FALSE; } yahoo_write_ready( d->id, d->fd, d->data ); @@ -685,7 +685,7 @@ int ext_yahoo_add_handler( int id, int fd, yahoo_input_condition cond, void *dat d->data = data; inp->d = d; - d->tag = inp->h = gaim_input_add( fd, GAIM_INPUT_READ, (GaimInputFunction) byahoo_read_ready_callback, (gpointer) d ); + d->tag = inp->h = b_input_add( fd, GAIM_INPUT_READ, (b_event_handler) byahoo_read_ready_callback, (gpointer) d ); } else if( cond == YAHOO_INPUT_WRITE ) { @@ -696,7 +696,7 @@ int ext_yahoo_add_handler( int id, int fd, yahoo_input_condition cond, void *dat d->data = data; inp->d = d; - d->tag = inp->h = gaim_input_add( fd, GAIM_INPUT_WRITE, (GaimInputFunction) byahoo_write_ready_callback, (gpointer) d ); + d->tag = inp->h = b_input_add( fd, GAIM_INPUT_WRITE, (b_event_handler) byahoo_write_ready_callback, (gpointer) d ); } else { @@ -727,7 +727,7 @@ void ext_yahoo_remove_handler( int id, int tag ) l = l->next; } - gaim_input_remove( tag ); + b_event_remove( tag ); } int ext_yahoo_connect_async( int id, char *host, int port, yahoo_connect_callback callback, void *data ) @@ -736,7 +736,7 @@ int ext_yahoo_connect_async( int id, char *host, int port, yahoo_connect_callbac int fd; d = g_new0( struct byahoo_connect_callback_data, 1 ); - if( ( fd = proxy_connect( host, port, (GaimInputFunction) byahoo_connect_callback, (gpointer) d ) ) < 0 ) + if( ( fd = proxy_connect( host, port, (b_event_handler) byahoo_connect_callback, (gpointer) d ) ) < 0 ) { g_free( d ); return( fd ); @@ -46,7 +46,7 @@ int main( int argc, char *argv[], char **envp ) memset( &global, 0, sizeof( global_t ) ); - global.loop = g_main_new( FALSE ); + b_main_init(); log_init(); @@ -116,7 +116,7 @@ int main( int argc, char *argv[], char **envp ) if( help_init( &(global.help) ) == NULL ) log_message( LOGLVL_WARNING, "Error opening helpfile %s.", HELP_FILE ); - g_main_run( global.loop ); + b_main_run(); if( global.restart ) { @@ -164,7 +164,7 @@ static void sighandler( int signal ) the user data now (not to mention writing them to disk), so add a timer. */ log_message( LOGLVL_ERROR, "SIGTERM received, cleaning up process." ); - g_timeout_add_full( G_PRIORITY_LOW, 1, (GSourceFunc) bitlbee_shutdown, NULL, NULL ); + b_timeout_add( 1, (b_event_handler) bitlbee_shutdown, NULL ); first = 0; } @@ -108,7 +108,7 @@ int user_del( irc_t *irc, char *nick ) if( u->away ) g_free( u->away ); if( u->handle ) g_free( u->handle ); if( u->sendbuf ) g_free( u->sendbuf ); - if( u->sendbuf_timer ) g_source_remove( u->sendbuf_timer ); + if( u->sendbuf_timer ) b_event_remove( u->sendbuf_timer ); g_free( u ); if( !g_hash_table_lookup_extended( irc->userhash, key, &okey, &ovalue ) || ovalue != u ) |