diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2006-05-10 19:34:46 +0200 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2006-05-10 19:34:46 +0200 |
commit | ba9edaa568088900145bbd1004c864b7d408c38d (patch) | |
tree | d6bd8b68d9d9ade9b3cb1e4d484751badc3c9bbe /protocols | |
parent | 67b6766489f1b9b5f2249659b0ddf260e6f8f51b (diff) |
Moved everything to the BitlBee event handling API.
Diffstat (limited to 'protocols')
-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 |
18 files changed, 266 insertions, 184 deletions
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 ); |