Changeset ba9edaa
- Timestamp:
- 2006-05-10T17:34:46Z (19 years ago)
- Branches:
- master
- Children:
- 13cc96c
- Parents:
- 67b6766
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
bitlbee.c
r67b6766 rba9edaa 34 34 #include <errno.h> 35 35 36 void bitlbee_io_new_client( gpointer data, gint source, GaimInputCondition condition );36 static gboolean bitlbee_io_new_client( gpointer data, gint source, b_input_condition condition ); 37 37 38 38 int bitlbee_daemon_init() … … 90 90 } 91 91 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 ); 93 93 94 94 #ifndef _WIN32 … … 145 145 } 146 146 147 void bitlbee_io_current_client_read( gpointer data, gint source, GaimInputCondition cond )147 gboolean bitlbee_io_current_client_read( gpointer data, gint source, b_input_condition cond ) 148 148 { 149 149 irc_t *irc = data; … … 155 155 { 156 156 irc_abort( irc, 1, "Connection reset by peer" ); 157 goto no_more_events;157 return FALSE; 158 158 } 159 159 else if( st < 0 ) … … 161 161 if( sockerr_again() ) 162 162 { 163 return ;163 return TRUE; 164 164 } 165 165 else 166 166 { 167 167 irc_abort( irc, 1, "Read error: %s", strerror( errno ) ); 168 goto no_more_events;168 return FALSE; 169 169 } 170 170 } … … 187 187 { 188 188 log_message( LOGLVL_WARNING, "Abnormal termination of connection with fd %d.", irc->fd ); 189 goto no_more_events;189 return FALSE; 190 190 } 191 191 … … 194 194 { 195 195 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 202 gboolean bitlbee_io_current_client_write( gpointer data, gint source, b_input_condition cond ) 207 203 { 208 204 irc_t *irc = data; … … 211 207 212 208 if( irc->sendbuffer == NULL ) 213 goto no_more_events;209 return FALSE; 214 210 215 211 size = strlen( irc->sendbuffer ); … … 219 215 { 220 216 irc_abort( irc, 1, "Write error: %s", strerror( errno ) ); 221 goto no_more_events;217 return FALSE; 222 218 } 223 219 else if( st < 0 ) /* && sockerr_again() */ 224 220 { 225 return ;221 return TRUE; 226 222 } 227 223 … … 230 226 g_free( irc->sendbuffer ); 231 227 irc->sendbuffer = NULL; 228 irc->w_watch_source_id = 0; 232 229 233 230 if( irc->status == USTATUS_SHUTDOWN ) 234 231 irc_free( irc ); 235 232 236 goto no_more_events;233 return FALSE; 237 234 } 238 235 else … … 242 239 irc->sendbuffer = temp; 243 240 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 245 static gboolean bitlbee_io_new_client( gpointer data, gint source, b_input_condition condition ) 253 246 { 254 247 socklen_t size = sizeof( struct sockaddr_in ); … … 260 253 { 261 254 log_message( LOGLVL_WARNING, "Could not accept new connection: %s", strerror( errno ) ); 262 return ;255 return TRUE; 263 256 } 264 257 … … 285 278 child->pid = client_pid; 286 279 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 ); 288 281 child_list = g_slist_append( child_list, child ); 289 282 … … 300 293 /* Close the listening socket, we're a client. */ 301 294 close( global.listen_socket ); 302 g_source_remove( global.listen_watch_source_id );295 b_event_remove( global.listen_watch_source_id ); 303 296 304 297 /* Make the connection. */ … … 307 300 /* We can store the IPC fd there now. */ 308 301 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 ); 310 303 311 304 close( fds[0] ); … … 319 312 irc_new( new_socket ); 320 313 } 321 } 322 323 void bitlbee_shutdown( gpointer data ) 314 315 return TRUE; 316 } 317 318 gboolean bitlbee_shutdown( gpointer data, gint fd, b_input_condition cond ) 324 319 { 325 320 /* Try to save data for all active connections (if desired). */ … … 328 323 329 324 /* 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 82 82 #undef g_timeout_add_full 83 83 #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__ 84 88 #undef g_source_remove 85 #define g_source_remove __PLEASE_USE_B_ SOURCE_REMOVE__89 #define g_source_remove __PLEASE_USE_B_EVENT_REMOVE__ 86 90 #undef g_source_remove_by_user_data 87 91 #define g_source_remove_by_user_data __PLEASE_USE_B_SOURCE_REMOVE_BY_USER_DATA__ … … 137 141 GList *storage; /* The first backend in the list will be used for saving */ 138 142 char *helpfile; 139 GMainLoop *loop;140 143 int restart; 141 144 } global_t; … … 144 147 int bitlbee_inetd_init( void ); 145 148 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 );149 gboolean bitlbee_io_current_client_read( gpointer data, gint source, b_input_condition cond ); 150 gboolean bitlbee_io_current_client_write( gpointer data, gint source, b_input_condition cond ); 148 151 149 152 void root_command_string( irc_t *irc, user_t *u, char *command, int flags ); 150 153 void root_command( irc_t *irc, char *command[] ); 151 void bitlbee_shutdown( gpointer data);154 gboolean bitlbee_shutdown( gpointer data, gint fd, b_input_condition cond ); 152 155 153 156 extern global_t global; -
ipc.c
r67b6766 rba9edaa 60 60 ipc_to_children_str( "DIE\r\n" ); 61 61 62 bitlbee_shutdown( NULL );62 bitlbee_shutdown( NULL, -1, 0 ); 63 63 } 64 64 … … 91 91 92 92 global.restart = -1; 93 bitlbee_shutdown( NULL );93 bitlbee_shutdown( NULL, -1, 0 ); 94 94 } 95 95 … … 246 246 } 247 247 248 void ipc_master_read( gpointer data, gint source, GaimInputCondition cond )248 gboolean ipc_master_read( gpointer data, gint source, b_input_condition cond ) 249 249 { 250 250 char *buf, **cmd; … … 272 272 } 273 273 } 274 } 275 276 void ipc_child_read( gpointer data, gint source, GaimInputCondition cond ) 274 275 return TRUE; 276 } 277 278 gboolean ipc_child_read( gpointer data, gint source, b_input_condition cond ) 277 279 { 278 280 char *buf, **cmd; … … 286 288 else 287 289 { 288 gaim_input_remove( global.listen_watch_source_id );290 b_event_remove( global.listen_watch_source_id ); 289 291 close( global.listen_socket ); 290 292 291 293 global.listen_socket = -1; 292 294 } 295 296 return TRUE; 293 297 } 294 298 … … 397 401 void ipc_master_free_one( struct bitlbee_child *c ) 398 402 { 399 gaim_input_remove( c->ipc_inpa );403 b_event_remove( c->ipc_inpa ); 400 404 closesocket( c->ipc_fd ); 401 405 … … 463 467 464 468 465 static void new_ipc_client( gpointer data, gint serversock, GaimInputCondition cond )469 static gboolean new_ipc_client( gpointer data, gint serversock, b_input_condition cond ) 466 470 { 467 471 struct bitlbee_child *child = g_new0( struct bitlbee_child, 1 ); … … 472 476 { 473 477 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 ); 478 482 479 483 child_list = g_slist_append( child_list, child ); 484 485 return TRUE; 480 486 } 481 487 … … 512 518 } 513 519 514 gaim_input_add( serversock, GAIM_INPUT_READ, new_ipc_client, NULL );520 b_input_add( serversock, GAIM_INPUT_READ, new_ipc_client, NULL ); 515 521 516 522 return 1; … … 552 558 return 0; 553 559 } 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 ); 555 561 556 562 child_list = g_slist_append( child_list, child ); -
ipc.h
r67b6766 rba9edaa 40 40 41 41 42 void ipc_master_read( gpointer data, gint source, GaimInputCondition cond );43 void ipc_child_read( gpointer data, gint source, GaimInputCondition cond );42 gboolean ipc_master_read( gpointer data, gint source, b_input_condition cond ); 43 gboolean ipc_child_read( gpointer data, gint source, b_input_condition cond ); 44 44 45 45 void ipc_master_free_one( struct bitlbee_child *child ); -
irc.c
r67b6766 rba9edaa 29 29 #include "ipc.h" 30 30 31 static gboolean irc_userping( gpointer _irc );31 static gboolean irc_userping( gpointer _irc, int fd, b_input_condition cond ); 32 32 33 33 GSList *irc_connection_list = NULL; … … 56 56 sock_make_nonblocking( irc->fd ); 57 57 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 ); 59 59 60 60 irc->status = USTATUS_OFFLINE; … … 114 114 115 115 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 ); 117 117 118 118 irc_write( irc, ":%s NOTICE AUTH :%s", irc->myhost, "BitlBee-IRCd initialized, please go on" ); … … 184 184 bitlbee_.._write doesn't do it first. */ 185 185 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 ); 188 188 } 189 189 else … … 218 218 219 219 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 ); 222 222 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 ); 224 224 225 225 irc_connection_list = g_slist_remove( irc_connection_list, irc ); … … 272 272 if(user->host!=user->nick) g_free(user->host); 273 273 if(user->realname!=user->nick) g_free(user->realname); 274 gaim_input_remove(user->sendbuf_timer);274 b_event_remove(user->sendbuf_timer); 275 275 276 276 usertmp = user; … … 322 322 323 323 if( global.conf->runmode == RUNMODE_INETD || global.conf->runmode == RUNMODE_FORKDAEMON ) 324 g_main_quit( global.loop);324 b_main_quit(); 325 325 } 326 326 … … 605 605 606 606 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 ); 608 608 609 609 return; … … 1011 1011 } 1012 1012 1013 gboolean buddy_send_handler_delayed( gpointer data)1013 static gboolean buddy_send_handler_delayed( gpointer data, gint fd, b_input_condition cond ) 1014 1014 { 1015 1015 user_t *u = data; … … 1024 1024 u->sendbuf_flags = 0; 1025 1025 1026 return ( FALSE );1026 return FALSE; 1027 1027 } 1028 1028 … … 1038 1038 { 1039 1039 //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 ); 1042 1042 } 1043 1043 … … 1063 1063 1064 1064 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 ); 1067 1067 } 1068 1068 else … … 1148 1148 pongs from the user. When not connected yet, we don't ping but drop the 1149 1149 connection when the user fails to connect in IRC_LOGIN_TIMEOUT secs. */ 1150 static gboolean irc_userping( gpointer _irc )1150 static gboolean irc_userping( gpointer _irc, gint fd, b_input_condition cond ) 1151 1151 { 1152 1152 irc_t *irc = _irc; -
protocols/events.h
r67b6766 rba9edaa 42 42 GAIM_INPUT_READ = 1 << 0, 43 43 GAIM_INPUT_WRITE = 1 << 1 44 } GaimInputCondition;45 typedef void (*GaimInputFunction)(gpointer, gint, GaimInputCondition);44 } b_input_condition; 45 typedef gboolean (*b_event_handler)(gpointer data, gint fd, b_input_condition cond); 46 46 47 47 #define GAIM_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR) … … 49 49 #define GAIM_ERR_COND (G_IO_HUP | G_IO_ERR | G_IO_NVAL) 50 50 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); 51 G_MODULE_EXPORT void b_main_init(); 52 G_MODULE_EXPORT void b_main_run(); 53 G_MODULE_EXPORT void b_main_quit(); 53 54 54 G_MODULE_EXPORT gint bee_timeout_add(gint timeout, GaimInputFunction func, gpointer data, gint priority); 55 G_MODULE_EXPORT gint b_input_add(int fd, b_input_condition cond, b_event_handler func, gpointer data); 56 G_MODULE_EXPORT gint b_timeout_add(gint timeout, b_event_handler func, gpointer data); 57 G_MODULE_EXPORT void b_event_remove(gint id); 58 G_MODULE_EXPORT gboolean b_event_remove_by_data(gpointer data); 55 59 56 60 #endif /* _EVENTS_H_ */ -
protocols/events_glib.c
r67b6766 rba9edaa 47 47 48 48 typedef struct _GaimIOClosure { 49 GaimInputFunctionfunction;49 b_event_handler function; 50 50 guint result; 51 51 gpointer data; 52 52 } GaimIOClosure; 53 53 54 static GMainLoop *loop; 55 56 void b_main_init() 57 { 58 loop = g_main_new( FALSE ); 59 } 60 61 void b_main_run() 62 { 63 g_main_run( loop ); 64 } 65 66 void b_main_quit() 67 { 68 g_main_quit( loop ); 69 } 70 54 71 static gboolean gaim_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data) 55 72 { 56 73 GaimIOClosure *closure = data; 57 GaimInputCondition gaim_cond = 0;74 b_input_condition gaim_cond = 0; 58 75 59 76 if (condition & GAIM_READ_COND) … … 62 79 gaim_cond |= GAIM_INPUT_WRITE; 63 80 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); 67 82 } 68 83 … … 72 87 } 73 88 74 gint gaim_input_add(gint source, GaimInputCondition condition, GaimInputFunctionfunction, gpointer data)89 gint b_input_add(gint source, b_input_condition condition, b_event_handler function, gpointer data) 75 90 { 76 91 GaimIOClosure *closure = g_new0(GaimIOClosure, 1); … … 94 109 } 95 110 96 void gaim_input_remove(gint tag) 111 gint b_timeout_add(gint timeout, b_event_handler func, gpointer data) 112 { 113 return g_timeout_add(timeout, func, data); 114 } 115 116 void b_event_remove(gint tag) 97 117 { 98 118 if (tag > 0) 99 119 g_source_remove(tag); 100 120 } 121 122 gboolean b_event_remove_by_data(gpointer data) 123 { 124 return g_source_remove_by_user_data(data); 125 } -
protocols/http_client.c
r67b6766 rba9edaa 32 32 33 33 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 );34 static gboolean http_connected( gpointer data, int source, b_input_condition cond ); 35 static gboolean http_ssl_connected( gpointer data, void *source, b_input_condition cond ); 36 static gboolean http_incoming_data( gpointer data, int source, b_input_condition cond ); 37 37 38 38 … … 73 73 /* This one is actually pretty simple... Might get more calls if we can't write 74 74 the whole request at once. */ 75 static void http_connected( gpointer data, int source, GaimInputCondition cond )75 static gboolean http_connected( gpointer data, int source, b_input_condition cond ) 76 76 { 77 77 struct http_request *req = data; … … 82 82 83 83 if( req->inpa > 0 ) 84 gaim_input_remove( req->inpa );84 b_event_remove( req->inpa ); 85 85 86 86 sock_make_nonblocking( req->fd ); … … 117 117 118 118 if( req->bytes_written < req->request_length ) 119 req->inpa = gaim_input_add( source,120 121 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; 126 126 127 127 error: … … 131 131 g_free( req ); 132 132 133 return ;133 return FALSE; 134 134 } 135 135 136 static void http_ssl_connected( gpointer data, void *source, GaimInputCondition cond )136 static gboolean http_ssl_connected( gpointer data, void *source, b_input_condition cond ) 137 137 { 138 138 struct http_request *req = data; … … 146 146 } 147 147 148 static void http_incoming_data( gpointer data, int source, GaimInputCondition cond )148 static gboolean http_incoming_data( gpointer data, int source, b_input_condition cond ) 149 149 { 150 150 struct http_request *req = data; … … 155 155 156 156 if( req->inpa > 0 ) 157 gaim_input_remove( req->inpa );157 b_event_remove( req->inpa ); 158 158 159 159 if( req->ssl ) … … 202 202 203 203 /* There will be more! */ 204 req->inpa = gaim_input_add( req->fd,205 206 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; 209 209 210 210 got_reply: … … 362 362 req->reply_headers = req->reply_body = NULL; 363 363 364 return ;364 return FALSE; 365 365 } 366 366 … … 380 380 g_free( req->reply_headers ); 381 381 g_free( req ); 382 383 return FALSE; 382 384 } -
protocols/jabber/jabber.c
r67b6766 rba9edaa 471 471 } 472 472 473 static void jabber_callback(gpointer data, gint source, GaimInputCondition condition)473 static gboolean jabber_callback(gpointer data, gint source, b_input_condition condition) 474 474 { 475 475 struct gaim_connection *gc = (struct gaim_connection *)data; … … 477 477 478 478 gjab_recv(jd->gjc); 479 480 return TRUE; 479 481 } 480 482 … … 487 489 } 488 490 489 static void gjab_connected(gpointer data, gint source, GaimInputCondition cond)491 static gboolean gjab_connected(gpointer data, gint source, b_input_condition cond) 490 492 { 491 493 xmlnode x; … … 497 499 if (!g_slist_find(get_connections(), gc)) { 498 500 closesocket(source); 499 return ;501 return FALSE; 500 502 } 501 503 … … 508 510 if (source == -1) { 509 511 STATE_EVT(JCONN_STATE_OFF) 510 return ;512 return FALSE; 511 513 } 512 514 … … 530 532 531 533 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 539 static gboolean gjab_connected_ssl(gpointer data, void *source, b_input_condition cond) 536 540 { 537 541 struct gaim_connection *gc = data; … … 544 548 if (source == NULL) { 545 549 STATE_EVT(JCONN_STATE_OFF) 546 return ;550 return FALSE; 547 551 } 548 552 549 553 if (!g_slist_find(get_connections(), gc)) { 550 554 ssl_disconnect(source); 551 return ;555 return FALSE; 552 556 } 553 557 554 gjab_connected(data, gjc->fd, cond);558 return gjab_connected(data, gjc->fd, cond); 555 559 } 556 560 … … 1543 1547 } 1544 1548 1545 static gboolean jabber_free(gpointer data )1549 static gboolean jabber_free(gpointer data, gint fd, b_input_condition cond) 1546 1550 { 1547 1551 struct jabber_data *jd = data; … … 1586 1590 } 1587 1591 if (gc->inpa) 1588 gaim_input_remove(gc->inpa);1592 b_event_remove(gc->inpa); 1589 1593 1590 1594 if(jd) { 1591 g_timeout_add(50, jabber_free, jd);1595 b_timeout_add(50, jabber_free, jd); 1592 1596 if(jd->gjc != NULL) 1593 1597 xmlnode_free(jd->gjc->current); -
protocols/msn/msn.h
r67b6766 rba9edaa 146 146 147 147 /* ns.c */ 148 void msn_ns_connected( gpointer data, gint source, GaimInputCondition cond );148 gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond ); 149 149 150 150 /* msn_util.c */ … … 173 173 void msn_sb_to_chat( struct msn_switchboard *sb ); 174 174 void msn_sb_destroy( struct msn_switchboard *sb ); 175 void msn_sb_connected( gpointer data, gint source, GaimInputCondition cond );175 gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond ); -
protocols/msn/ns.c
r67b6766 rba9edaa 30 30 #include "md5.h" 31 31 32 static void msn_ns_callback( gpointer data, gint source, GaimInputCondition cond );32 static gboolean msn_ns_callback( gpointer data, gint source, b_input_condition cond ); 33 33 static int msn_ns_command( gpointer data, char **cmd, int num_parts ); 34 34 static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int num_parts ); … … 36 36 static void msn_auth_got_passport_id( struct passport_reply *rep ); 37 37 38 void msn_ns_connected( gpointer data, gint source, GaimInputCondition cond )38 gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond ) 39 39 { 40 40 struct gaim_connection *gc = data; … … 43 43 44 44 if( !g_slist_find( msn_connections, gc ) ) 45 return ;45 return FALSE; 46 46 47 47 if( source == -1 ) … … 49 49 hide_login_progress( gc, "Could not connect to server" ); 50 50 signoff( gc ); 51 return ;51 return FALSE; 52 52 } 53 53 … … 75 75 if( msn_write( gc, s, strlen( s ) ) ) 76 76 { 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 ); 78 78 set_login_progress( gc, 1, "Connected to server, waiting for reply" ); 79 79 } 80 81 return FALSE; 80 82 } 81 83 82 void msn_ns_callback( gpointer data, gint source, GaimInputCondition cond )84 static gboolean msn_ns_callback( gpointer data, gint source, b_input_condition cond ) 83 85 { 84 86 struct gaim_connection *gc = data; … … 89 91 hide_login_progress( gc, "Error while reading from server" ); 90 92 signoff( gc ); 91 } 93 94 return FALSE; 95 } 96 else 97 return TRUE; 92 98 } 93 99 … … 130 136 if( num_parts == 6 && strcmp( cmd[2], "NS" ) == 0 ) 131 137 { 132 gaim_input_remove( gc->inpa );138 b_event_remove( gc->inpa ); 133 139 gc->inpa = 0; 134 140 closesocket( md->fd ); -
protocols/msn/sb.c
r67b6766 rba9edaa 30 30 #include "md5.h" 31 31 32 static void msn_sb_callback( gpointer data, gint source, GaimInputCondition cond );32 static gboolean msn_sb_callback( gpointer data, gint source, b_input_condition cond ); 33 33 static int msn_sb_command( gpointer data, char **cmd, int num_parts ); 34 34 static int msn_sb_message( gpointer data, char *msg, int msglen, char **cmd, int num_parts ); … … 237 237 } 238 238 239 if( sb->inp ) gaim_input_remove( sb->inp );239 if( sb->inp ) b_event_remove( sb->inp ); 240 240 closesocket( sb->fd ); 241 241 … … 245 245 } 246 246 247 void msn_sb_connected( gpointer data, gint source, GaimInputCondition cond )247 gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond ) 248 248 { 249 249 struct msn_switchboard *sb = data; … … 254 254 /* Are we still alive? */ 255 255 if( !g_slist_find( msn_switchboards, sb ) ) 256 return ;256 return FALSE; 257 257 258 258 gc = sb->gc; … … 263 263 debug( "ERROR %d while connecting to switchboard server", 1 ); 264 264 msn_sb_destroy( sb ); 265 return ;265 return FALSE; 266 266 } 267 267 … … 280 280 281 281 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 ); 283 283 else 284 284 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 289 static gboolean msn_sb_callback( gpointer data, gint source, b_input_condition cond ) 288 290 { 289 291 struct msn_switchboard *sb = data; … … 293 295 debug( "ERROR: Switchboard died" ); 294 296 msn_sb_destroy( sb ); 295 } 297 298 return FALSE; 299 } 300 else 301 return TRUE; 296 302 } 297 303 -
protocols/nogaim.c
r67b6766 rba9edaa 328 328 } 329 329 330 static gboolean send_keepalive( gpointer d )330 static gboolean send_keepalive( gpointer d, gint fd, b_input_condition cond ) 331 331 { 332 332 struct gaim_connection *gc = d; … … 352 352 serv_got_crap( gc, "Logged in" ); 353 353 354 gc->keepalive = g_timeout_add( 60000, send_keepalive, gc );354 gc->keepalive = b_timeout_add( 60000, send_keepalive, gc ); 355 355 gc->flags |= OPT_LOGGED_IN; 356 356 … … 360 360 } 361 361 362 gboolean auto_reconnect( gpointer data )362 gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond ) 363 363 { 364 364 account_t *a = data; … … 372 372 void cancel_auto_reconnect( account_t *a ) 373 373 { 374 while( g_source_remove_by_user_data( (gpointer) a ) );374 while( b_event_remove_by_data( (gpointer) a ) ); 375 375 a->reconnect = 0; 376 376 } … … 384 384 serv_got_crap( gc, "Signing off.." ); 385 385 386 gaim_input_remove( gc->keepalive );386 b_event_remove( gc->keepalive ); 387 387 gc->keepalive = 0; 388 388 gc->prpl->close( gc ); 389 gaim_input_remove( gc->inpa );389 b_event_remove( gc->inpa ); 390 390 391 391 while( u ) … … 417 417 418 418 a->reconnect = 1; 419 g_timeout_add( delay * 1000, auto_reconnect, a );419 b_timeout_add( delay * 1000, auto_reconnect, a ); 420 420 } 421 421 -
protocols/nogaim.h
r67b6766 rba9edaa 201 201 char *set_eval_away_devoice( irc_t *irc, set_t *set, char *value ); 202 202 203 gboolean auto_reconnect( gpointer data );203 gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond ); 204 204 void cancel_auto_reconnect( struct account *a ); 205 205 -
protocols/oscar/oscar.c
r67b6766 rba9edaa 253 253 static int msgerrreasonlen = 25; 254 254 255 static voidoscar_callback(gpointer data, gint source,256 GaimInputCondition condition) {255 static gboolean oscar_callback(gpointer data, gint source, 256 b_input_condition condition) { 257 257 aim_conn_t *conn = (aim_conn_t *)data; 258 258 aim_session_t *sess = aim_conn_getsess(conn); … … 262 262 if (!gc) { 263 263 /* gc is null. we return, else we seg SIGSEG on next line. */ 264 return ;264 return FALSE; 265 265 } 266 266 … … 268 268 /* oh boy. this is probably bad. i guess the only thing we 269 269 * can really do is return? */ 270 return ;270 return FALSE; 271 271 } 272 272 … … 288 288 c->conn = NULL; 289 289 if (c->inpa > 0) 290 gaim_input_remove(c->inpa);290 b_event_remove(c->inpa); 291 291 c->inpa = 0; 292 292 c->fd = -1; … … 296 296 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { 297 297 if (odata->cnpa > 0) 298 gaim_input_remove(odata->cnpa);298 b_event_remove(odata->cnpa); 299 299 odata->cnpa = 0; 300 300 while (odata->create_rooms) { … … 310 310 } else if (conn->type == AIM_CONN_TYPE_AUTH) { 311 311 if (odata->paspa > 0) 312 gaim_input_remove(odata->paspa);312 b_event_remove(odata->paspa); 313 313 odata->paspa = 0; 314 314 aim_conn_kill(odata->sess, &conn); … … 317 317 } 318 318 } 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 327 static gboolean oscar_login_connect(gpointer data, gint source, b_input_condition cond) 323 328 { 324 329 struct gaim_connection *gc = data; … … 329 334 if (!g_slist_find(get_connections(), gc)) { 330 335 closesocket(source); 331 return ;336 return FALSE; 332 337 } 333 338 … … 339 344 hide_login_progress(gc, _("Couldn't connect to host")); 340 345 signoff(gc); 341 return ;346 return FALSE; 342 347 } 343 348 344 349 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, 346 351 oscar_callback, conn); 352 353 return FALSE; 347 354 } 348 355 … … 412 419 struct chat_connection *n = odata->oscar_chats->data; 413 420 if (n->inpa > 0) 414 gaim_input_remove(n->inpa);421 b_event_remove(n->inpa); 415 422 g_free(n->name); 416 423 g_free(n->show); … … 431 438 g_free(odata->oldp); 432 439 if (gc->inpa > 0) 433 gaim_input_remove(gc->inpa);440 b_event_remove(gc->inpa); 434 441 if (odata->cnpa > 0) 435 gaim_input_remove(odata->cnpa);442 b_event_remove(odata->cnpa); 436 443 if (odata->paspa > 0) 437 gaim_input_remove(odata->paspa);444 b_event_remove(odata->paspa); 438 445 aim_session_kill(odata->sess); 439 446 g_free(odata->sess); … … 443 450 } 444 451 445 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) {452 static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition cond) { 446 453 struct gaim_connection *gc = data; 447 454 struct oscar_data *odata; … … 451 458 if (!g_slist_find(get_connections(), gc)) { 452 459 closesocket(source); 453 return ;460 return FALSE; 454 461 } 455 462 … … 461 468 hide_login_progress(gc, _("Could Not Connect")); 462 469 signoff(gc); 463 return ;470 return FALSE; 464 471 } 465 472 466 473 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, 468 475 oscar_callback, bosconn); 469 476 set_login_progress(gc, 4, _("Connection established, cookie sent")); 477 478 return FALSE; 470 479 } 471 480 … … 570 579 } 571 580 aim_sendcookie(sess, bosconn, info->cookie); 572 gaim_input_remove(gc->inpa);581 b_event_remove(gc->inpa); 573 582 574 583 return 1; … … 585 594 }; 586 595 587 static void damn_you(gpointer data, gint source, GaimInputCondition c)596 static gboolean damn_you(gpointer data, gint source, b_input_condition c) 588 597 { 589 598 struct pieceofcrap *pos = data; … … 605 614 do_error_dialog(pos->gc, "Gaim was unable to get a valid hash for logging into AIM." 606 615 " You may be disconnected shortly.", "Login Error"); 607 gaim_input_remove(pos->inpa);616 b_event_remove(pos->inpa); 608 617 closesocket(pos->fd); 609 618 g_free(pos); 610 return ;619 return FALSE; 611 620 } 612 621 /* [WvG] Wheeeee! Who needs error checking anyway? ;-) */ 613 622 read(pos->fd, m, 16); 614 623 m[16] = '\0'; 615 gaim_input_remove(pos->inpa);624 b_event_remove(pos->inpa); 616 625 closesocket(pos->fd); 617 626 aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); 618 627 g_free(pos); 619 } 620 621 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) { 628 629 return FALSE; 630 } 631 632 static gboolean straight_to_hell(gpointer data, gint source, b_input_condition cond) { 622 633 struct pieceofcrap *pos = data; 623 634 char buf[BUF_LONG]; … … 629 640 g_free(pos->modname); 630 641 g_free(pos); 631 return ;642 return FALSE; 632 643 } 633 644 … … 638 649 if (pos->modname) 639 650 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; 642 653 } 643 654 … … 761 772 } 762 773 763 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) {774 static gboolean oscar_chatnav_connect(gpointer data, gint source, b_input_condition cond) { 764 775 struct gaim_connection *gc = data; 765 776 struct oscar_data *odata; … … 769 780 if (!g_slist_find(get_connections(), gc)) { 770 781 closesocket(source); 771 return ;782 return FALSE; 772 783 } 773 784 … … 778 789 if (source < 0) { 779 790 aim_conn_kill(sess, &tstconn); 780 return ;791 return FALSE; 781 792 } 782 793 783 794 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, 785 796 oscar_callback, tstconn); 786 } 787 788 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) 797 798 return FALSE; 799 } 800 801 static gboolean oscar_auth_connect(gpointer data, gint source, b_input_condition cond) 789 802 { 790 803 struct gaim_connection *gc = data; … … 795 808 if (!g_slist_find(get_connections(), gc)) { 796 809 closesocket(source); 797 return ;810 return FALSE; 798 811 } 799 812 … … 804 817 if (source < 0) { 805 818 aim_conn_kill(sess, &tstconn); 806 return ;819 return FALSE; 807 820 } 808 821 809 822 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, 811 824 oscar_callback, tstconn); 812 } 813 814 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) 825 826 return FALSE; 827 } 828 829 static gboolean oscar_chat_connect(gpointer data, gint source, b_input_condition cond) 815 830 { 816 831 struct chat_connection *ccon = data; … … 825 840 g_free(ccon->name); 826 841 g_free(ccon); 827 return ;842 return FALSE; 828 843 } 829 844 … … 837 852 g_free(ccon->name); 838 853 g_free(ccon); 839 return ;854 return FALSE; 840 855 } 841 856 842 857 aim_conn_completeconnect(sess, ccon->conn); 843 ccon->inpa = gaim_input_add(tstconn->fd,858 ccon->inpa = b_input_add(tstconn->fd, 844 859 GAIM_INPUT_READ, 845 860 oscar_callback, tstconn); 846 861 odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon); 862 863 return FALSE; 847 864 } 848 865 … … 2558 2575 od->oscar_chats = g_slist_remove(od->oscar_chats, cc); 2559 2576 if (cc->inpa > 0) 2560 gaim_input_remove(cc->inpa);2577 b_event_remove(cc->inpa); 2561 2578 aim_conn_kill(od->sess, &cc->conn); 2562 2579 g_free(cc->name); -
protocols/proxy.c
r67b6766 rba9edaa 49 49 50 50 struct PHB { 51 GaimInputFunctionfunc, proxy_func;51 b_event_handler func, proxy_func; 52 52 gpointer data, proxy_data; 53 53 char *host; … … 78 78 } 79 79 80 static void gaim_io_connected(gpointer data, gint source, GaimInputCondition cond)80 static gboolean gaim_io_connected(gpointer data, gint source, b_input_condition cond) 81 81 { 82 82 struct PHB *phb = data; … … 88 88 if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { 89 89 closesocket(source); 90 gaim_input_remove(phb->inpa);90 b_event_remove(phb->inpa); 91 91 if( phb->proxy_func ) 92 92 phb->proxy_func(phb->proxy_data, -1, GAIM_INPUT_READ); … … 95 95 g_free(phb); 96 96 } 97 return ;97 return FALSE; 98 98 } 99 99 #endif 100 100 sock_make_blocking(source); 101 gaim_input_remove(phb->inpa);101 b_event_remove(phb->inpa); 102 102 if( phb->proxy_func ) 103 103 phb->proxy_func(phb->proxy_data, source, GAIM_INPUT_READ); … … 106 106 g_free(phb); 107 107 } 108 109 return FALSE; 108 110 } 109 111 … … 127 129 if (connect(fd, (struct sockaddr *)sin, sizeof(*sin)) < 0) { 128 130 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); 130 132 phb->fd = fd; 131 133 } else { … … 145 147 #define HTTP_GOODSTRING2 "HTTP/1.1 200 Connection established" 146 148 147 static void http_canread(gpointer data, gint source, GaimInputCondition cond)149 static gboolean http_canread(gpointer data, gint source, b_input_condition cond) 148 150 { 149 151 int nlc = 0; … … 152 154 char inputline[8192]; 153 155 154 gaim_input_remove(phb->inpa);156 b_event_remove(phb->inpa); 155 157 156 158 while ((pos < sizeof(inputline)-1) && (nlc != 2) && (read(source, &inputline[pos++], 1) == 1)) { … … 167 169 g_free(phb->host); 168 170 g_free(phb); 169 return ;171 return FALSE; 170 172 } 171 173 … … 174 176 g_free(phb->host); 175 177 g_free(phb); 176 return; 177 } 178 179 static void http_canwrite(gpointer data, gint source, GaimInputCondition cond) 178 179 return FALSE; 180 } 181 182 static gboolean http_canwrite(gpointer data, gint source, b_input_condition cond) 180 183 { 181 184 char cmd[384]; … … 184 187 int error = ETIMEDOUT; 185 188 if (phb->inpa > 0) 186 gaim_input_remove(phb->inpa);189 b_event_remove(phb->inpa); 187 190 len = sizeof(error); 188 191 if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { … … 191 194 g_free(phb->host); 192 195 g_free(phb); 193 return ;196 return FALSE; 194 197 } 195 198 sock_make_blocking(source); … … 202 205 g_free(phb->host); 203 206 g_free(phb); 204 return ;207 return FALSE; 205 208 } 206 209 … … 217 220 g_free(phb->host); 218 221 g_free(phb); 219 return ;222 return FALSE; 220 223 } 221 224 } … … 227 230 g_free(phb->host); 228 231 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; 233 238 } 234 239 … … 246 251 /* Connecting to SOCKS4 proxies */ 247 252 248 static void s4_canread(gpointer data, gint source, GaimInputCondition cond)253 static gboolean s4_canread(gpointer data, gint source, b_input_condition cond) 249 254 { 250 255 unsigned char packet[12]; 251 256 struct PHB *phb = data; 252 257 253 gaim_input_remove(phb->inpa);258 b_event_remove(phb->inpa); 254 259 255 260 memset(packet, 0, sizeof(packet)); … … 258 263 g_free(phb->host); 259 264 g_free(phb); 260 return ;265 return FALSE; 261 266 } 262 267 … … 265 270 g_free(phb->host); 266 271 g_free(phb); 267 } 268 269 static void s4_canwrite(gpointer data, gint source, GaimInputCondition cond) 272 273 return FALSE; 274 } 275 276 static gboolean s4_canwrite(gpointer data, gint source, b_input_condition cond) 270 277 { 271 278 unsigned char packet[12]; … … 275 282 int error = ETIMEDOUT; 276 283 if (phb->inpa > 0) 277 gaim_input_remove(phb->inpa);284 b_event_remove(phb->inpa); 278 285 len = sizeof(error); 279 286 if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { … … 282 289 g_free(phb->host); 283 290 g_free(phb); 284 return ;291 return FALSE; 285 292 } 286 293 sock_make_blocking(source); … … 292 299 g_free(phb->host); 293 300 g_free(phb); 294 return ;301 return FALSE; 295 302 } 296 303 … … 309 316 g_free(phb->host); 310 317 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; 315 324 } 316 325 … … 328 337 /* Connecting to SOCKS5 proxies */ 329 338 330 static void s5_canread_again(gpointer data, gint source, GaimInputCondition cond)339 static gboolean s5_canread_again(gpointer data, gint source, b_input_condition cond) 331 340 { 332 341 unsigned char buf[512]; 333 342 struct PHB *phb = data; 334 343 335 gaim_input_remove(phb->inpa);344 b_event_remove(phb->inpa); 336 345 337 346 if (read(source, buf, 10) < 10) { … … 340 349 g_free(phb->host); 341 350 g_free(phb); 342 return ;351 return FALSE; 343 352 } 344 353 if ((buf[0] != 0x05) || (buf[1] != 0x00)) { … … 347 356 g_free(phb->host); 348 357 g_free(phb); 349 return ;358 return FALSE; 350 359 } 351 360 … … 353 362 g_free(phb->host); 354 363 g_free(phb); 355 return; 364 365 return FALSE; 356 366 } 357 367 … … 361 371 struct PHB *phb = data; 362 372 int hlen = strlen(phb->host); 363 373 364 374 buf[0] = 0x05; 365 375 buf[1] = 0x01; /* CONNECT */ … … 379 389 } 380 390 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 394 static gboolean s5_readauth(gpointer data, gint source, b_input_condition cond) 385 395 { 386 396 unsigned char buf[512]; 387 397 struct PHB *phb = data; 388 398 389 gaim_input_remove(phb->inpa);399 b_event_remove(phb->inpa); 390 400 391 401 if (read(source, buf, 2) < 2) { … … 394 404 g_free(phb->host); 395 405 g_free(phb); 396 return ;406 return FALSE; 397 407 } 398 408 … … 402 412 g_free(phb->host); 403 413 g_free(phb); 404 return ;414 return FALSE; 405 415 } 406 416 407 417 s5_sendconnect(phb, source); 408 } 409 410 static void s5_canread(gpointer data, gint source, GaimInputCondition cond) 418 419 return FALSE; 420 } 421 422 static gboolean s5_canread(gpointer data, gint source, b_input_condition cond) 411 423 { 412 424 unsigned char buf[512]; 413 425 struct PHB *phb = data; 414 426 415 gaim_input_remove(phb->inpa);427 b_event_remove(phb->inpa); 416 428 417 429 if (read(source, buf, 2) < 2) { … … 420 432 g_free(phb->host); 421 433 g_free(phb); 422 return ;434 return FALSE; 423 435 } 424 436 … … 428 440 g_free(phb->host); 429 441 g_free(phb); 430 return ;442 return FALSE; 431 443 } 432 444 … … 443 455 g_free(phb->host); 444 456 g_free(phb); 445 return ;457 return FALSE; 446 458 } 447 459 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); 449 461 } else { 450 462 s5_sendconnect(phb, source); 451 463 } 452 } 453 454 static void s5_canwrite(gpointer data, gint source, GaimInputCondition cond) 464 465 return FALSE; 466 } 467 468 static gboolean s5_canwrite(gpointer data, gint source, b_input_condition cond) 455 469 { 456 470 unsigned char buf[512]; … … 460 474 int error = ETIMEDOUT; 461 475 if (phb->inpa > 0) 462 gaim_input_remove(phb->inpa);476 b_event_remove(phb->inpa); 463 477 len = sizeof(error); 464 478 if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { … … 467 481 g_free(phb->host); 468 482 g_free(phb); 469 return ;483 return FALSE; 470 484 } 471 485 sock_make_blocking(source); … … 489 503 g_free(phb->host); 490 504 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; 495 511 } 496 512 … … 508 524 /* Export functions */ 509 525 510 int proxy_connect(const char *host, int port, GaimInputFunctionfunc, gpointer data)526 int proxy_connect(const char *host, int port, b_event_handler func, gpointer data) 511 527 { 512 528 struct PHB *phb; -
protocols/proxy.h
r67b6766 rba9edaa 49 49 extern char proxypass[128]; 50 50 51 G_MODULE_EXPORT int proxy_connect(const char *host, int port, GaimInputFunctionfunc, gpointer data);51 G_MODULE_EXPORT int proxy_connect(const char *host, int port, b_event_handler func, gpointer data); 52 52 53 53 #endif /* _PROXY_H_ */ -
protocols/ssl_bogus.c
r67b6766 rba9edaa 52 52 } 53 53 54 GaimInputCondition ssl_getdirection( void *conn )54 b_input_condition ssl_getdirection( void *conn ) 55 55 { 56 56 return GAIM_INPUT_READ; -
protocols/ssl_client.h
r67b6766 rba9edaa 33 33 extern int ssl_errno; 34 34 35 typedef void (*ssl_input_function)(gpointer, void*, GaimInputCondition);35 typedef gboolean (*ssl_input_function)(gpointer, void*, b_input_condition); 36 36 37 37 G_MODULE_EXPORT void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data ); … … 40 40 G_MODULE_EXPORT void ssl_disconnect( void *conn_ ); 41 41 G_MODULE_EXPORT int ssl_getfd( void *conn ); 42 G_MODULE_EXPORT GaimInputCondition ssl_getdirection( void *conn );42 G_MODULE_EXPORT b_input_condition ssl_getdirection( void *conn ); -
protocols/ssl_gnutls.c
r67b6766 rba9edaa 48 48 }; 49 49 50 static void ssl_connected( gpointer data, gint source, GaimInputCondition cond );50 static void ssl_connected( gpointer data, gint source, b_input_condition cond ); 51 51 52 52 … … 81 81 } 82 82 83 static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond );84 85 static void ssl_connected( gpointer data, gint source, GaimInputCondition cond )83 static void ssl_handshake( gpointer data, gint source, b_input_condition cond ); 84 85 static void ssl_connected( gpointer data, gint source, b_input_condition cond ) 86 86 { 87 87 struct scd *conn = data; … … 105 105 } 106 106 107 static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond )107 static void ssl_handshake( gpointer data, gint source, b_input_condition cond ) 108 108 { 109 109 struct scd *conn = data; … … 204 204 } 205 205 206 GaimInputCondition ssl_getdirection( void *conn )206 b_input_condition ssl_getdirection( void *conn ) 207 207 { 208 208 return( gnutls_record_get_direction( ((struct scd*)conn)->session ) ? -
protocols/ssl_nss.c
r67b6766 rba9edaa 52 52 }; 53 53 54 static void ssl_connected( gpointer data, gint source, GaimInputCondition cond );54 static gboolean ssl_connected( gpointer data, gint source, b_input_condition cond ); 55 55 56 56 … … 116 116 } 117 117 118 static void ssl_connected( gpointer data, gint source, GaimInputCondition cond )118 static gboolean ssl_connected( gpointer data, gint source, b_input_condition cond ) 119 119 { 120 120 struct scd *conn = data; … … 140 140 conn->established = TRUE; 141 141 conn->func( conn->data, conn, cond ); 142 return ;142 return FALSE; 143 143 144 144 ssl_connected_failure: … … 149 149 if( source >= 0 ) closesocket( source ); 150 150 g_free( conn ); 151 152 return FALSE; 151 153 } 152 154 … … 182 184 } 183 185 184 GaimInputCondition ssl_getdirection( void *conn )186 b_input_condition ssl_getdirection( void *conn ) 185 187 { 186 188 /* Just in case someone calls us, let's return the most likely case: */ -
protocols/ssl_openssl.c
r67b6766 rba9edaa 52 52 }; 53 53 54 static void ssl_connected( gpointer data, gint source, GaimInputCondition cond );54 static void ssl_connected( gpointer data, gint source, b_input_condition cond ); 55 55 56 56 … … 95 95 } 96 96 97 static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond );98 99 static void ssl_connected( gpointer data, gint source, GaimInputCondition cond )97 static void ssl_handshake( gpointer data, gint source, b_input_condition cond ); 98 99 static void ssl_connected( gpointer data, gint source, b_input_condition cond ) 100 100 { 101 101 struct scd *conn = data; … … 111 111 } 112 112 113 static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond )113 static void ssl_handshake( gpointer data, gint source, b_input_condition cond ) 114 114 { 115 115 struct scd *conn = data; … … 221 221 } 222 222 223 GaimInputCondition ssl_getdirection( void *conn )223 b_input_condition ssl_getdirection( void *conn ) 224 224 { 225 225 return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? GAIM_INPUT_WRITE : GAIM_INPUT_READ ); -
protocols/yahoo/yahoo.c
r67b6766 rba9edaa 443 443 }; 444 444 445 void byahoo_connect_callback( gpointer data, gint source, GaimInputCondition cond )445 void byahoo_connect_callback( gpointer data, gint source, b_input_condition cond ) 446 446 { 447 447 struct byahoo_connect_callback_data *d = data; … … 465 465 }; 466 466 467 void byahoo_read_ready_callback( gpointer data, gint source, GaimInputCondition cond )467 gboolean byahoo_read_ready_callback( gpointer data, gint source, b_input_condition cond ) 468 468 { 469 469 struct byahoo_read_ready_data *d = data; … … 473 473 /* WTF doesn't libyahoo clean this up? */ 474 474 ext_yahoo_remove_handler( d->id, d->tag ); 475 return ;475 return FALSE; 476 476 } 477 477 … … 487 487 }; 488 488 489 void byahoo_write_ready_callback( gpointer data, gint source, GaimInputCondition cond )489 gboolean byahoo_write_ready_callback( gpointer data, gint source, b_input_condition cond ) 490 490 { 491 491 struct byahoo_write_ready_data *d = data; … … 495 495 /* WTF doesn't libyahoo clean this up? */ 496 496 ext_yahoo_remove_handler( d->id, d->tag ); 497 return ;497 return FALSE; 498 498 } 499 499 … … 686 686 687 687 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 ); 689 689 } 690 690 else if( cond == YAHOO_INPUT_WRITE ) … … 697 697 698 698 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 ); 700 700 } 701 701 else … … 728 728 } 729 729 730 gaim_input_remove( tag );730 b_event_remove( tag ); 731 731 } 732 732 … … 737 737 738 738 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 ) 740 740 { 741 741 g_free( d ); -
unix.c
r67b6766 rba9edaa 47 47 memset( &global, 0, sizeof( global_t ) ); 48 48 49 global.loop = g_main_new( FALSE);49 b_main_init(); 50 50 51 51 log_init(); … … 117 117 log_message( LOGLVL_WARNING, "Error opening helpfile %s.", HELP_FILE ); 118 118 119 g_main_run( global.loop);119 b_main_run(); 120 120 121 121 if( global.restart ) … … 165 165 166 166 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 ); 168 168 169 169 first = 0; -
user.c
r67b6766 rba9edaa 109 109 if( u->handle ) g_free( u->handle ); 110 110 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 ); 112 112 g_free( u ); 113 113
Note: See TracChangeset
for help on using the changeset viewer.