Changes in / [3af70b0:b72caac]


Ignore:
Files:
3 added
27 edited

Legend:

Unmodified
Added
Removed
  • bitlbee.c

    r3af70b0 rb72caac  
    3434#include <errno.h>
    3535
    36 gboolean bitlbee_io_new_client( GIOChannel *source, GIOCondition condition, gpointer data );
     36static gboolean bitlbee_io_new_client( gpointer data, gint fd, b_input_condition condition );
    3737
    3838int bitlbee_daemon_init()
     
    4444#endif
    4545        int i;
    46         GIOChannel *ch;
    4746        FILE *fp;
    4847       
     
    9190        }
    9291       
    93         ch = g_io_channel_unix_new( global.listen_socket );
    94         global.listen_watch_source_id = g_io_add_watch( ch, G_IO_IN, 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 );
    9593       
    9694#ifndef _WIN32
     
    147145}
    148146
    149 gboolean bitlbee_io_current_client_read( GIOChannel *source, GIOCondition condition, gpointer data )
     147gboolean bitlbee_io_current_client_read( gpointer data, gint fd, b_input_condition cond )
    150148{
    151149        irc_t *irc = data;
     
    153151        int st;
    154152       
    155         if( condition & G_IO_ERR || condition & G_IO_HUP )
    156         {
    157                 irc_abort( irc, 1, "Read error" );
    158                 return FALSE;
    159         }
    160        
    161153        st = read( irc->fd, line, sizeof( line ) - 1 );
    162154        if( st == 0 )
     
    194186        if( !g_slist_find( irc_connection_list, irc ) )
    195187        {
    196                 log_message( LOGLVL_WARNING, "Abnormal termination of connection with fd %d.", irc->fd );
     188                log_message( LOGLVL_WARNING, "Abnormal termination of connection with fd %d.", fd );
    197189                return FALSE;
    198190        }
     
    208200}
    209201
    210 gboolean bitlbee_io_current_client_write( GIOChannel *source, GIOCondition condition, gpointer data )
     202gboolean bitlbee_io_current_client_write( gpointer data, gint fd, b_input_condition cond )
    211203{
    212204        irc_t *irc = data;
     
    215207
    216208        if( irc->sendbuffer == NULL )
    217                 return( FALSE );
     209                return FALSE;
    218210       
    219211        size = strlen( irc->sendbuffer );
     
    239231                        irc_free( irc );
    240232               
    241                 return( FALSE );
     233                return FALSE;
    242234        }
    243235        else
     
    247239                irc->sendbuffer = temp;
    248240               
    249                 return( TRUE );
    250         }
    251 }
    252 
    253 gboolean bitlbee_io_new_client( GIOChannel *source, GIOCondition condition, gpointer data )
    254 {
    255         size_t size = sizeof( struct sockaddr_in );
     241                return TRUE;
     242        }
     243}
     244
     245static gboolean bitlbee_io_new_client( gpointer data, gint fd, b_input_condition condition )
     246{
     247        socklen_t size = sizeof( struct sockaddr_in );
    256248        struct sockaddr_in conn_info;
    257249        int new_socket = accept( global.listen_socket, (struct sockaddr *) &conn_info, &size );
     
    286278                        child->pid = client_pid;
    287279                        child->ipc_fd = fds[0];
    288                         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 );
    289281                        child_list = g_slist_append( child_list, child );
    290282                       
     
    301293                        /* Close the listening socket, we're a client. */
    302294                        close( global.listen_socket );
    303                         g_source_remove( global.listen_watch_source_id );
     295                        b_event_remove( global.listen_watch_source_id );
    304296                       
    305297                        /* Make the connection. */
     
    308300                        /* We can store the IPC fd there now. */
    309301                        global.listen_socket = fds[1];
    310                         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 );
    311303                       
    312304                        close( fds[0] );
     
    324316}
    325317
    326 void bitlbee_shutdown( gpointer data )
     318gboolean bitlbee_shutdown( gpointer data, gint fd, b_input_condition cond )
    327319{
    328320        /* Try to save data for all active connections (if desired). */
     
    331323       
    332324        /* We'll only reach this point when not running in inetd mode: */
    333         g_main_quit( global.loop );
    334 }
     325        b_main_quit();
     326       
     327        return FALSE;
     328}
  • bitlbee.h

    r3af70b0 rb72caac  
    5858/* The following functions should not be used if we want to maintain Windows compatibility... */
    5959#undef free
    60 #define free            __PLEASE_USE_THE_GLIB_MEMORY_ALLOCATION_SYSTEM_INSTEAD__
     60#define free            __PLEASE_USE_THE_GLIB_MEMORY_ALLOCATION_SYSTEM__
    6161#undef malloc
    62 #define malloc          __PLEASE_USE_THE_GLIB_MEMORY_ALLOCATION_SYSTEM_INSTEAD__
     62#define malloc          __PLEASE_USE_THE_GLIB_MEMORY_ALLOCATION_SYSTEM__
    6363#undef calloc
    64 #define calloc          __PLEASE_USE_THE_GLIB_MEMORY_ALLOCATION_SYSTEM_INSTEAD__
     64#define calloc          __PLEASE_USE_THE_GLIB_MEMORY_ALLOCATION_SYSTEM__
    6565#undef realloc
    66 #define realloc         __PLEASE_USE_THE_GLIB_MEMORY_ALLOCATION_SYSTEM_INSTEAD__
     66#define realloc         __PLEASE_USE_THE_GLIB_MEMORY_ALLOCATION_SYSTEM__
    6767#undef strdup
    68 #define strdup          __PLEASE_USE_THE_GLIB_STRDUP_FUNCTIONS_SYSTEM_INSTEAD__
     68#define strdup          __PLEASE_USE_THE_GLIB_STRDUP_FUNCTIONS_SYSTEM__
    6969#undef strndup
    70 #define strndup         __PLEASE_USE_THE_GLIB_STRDUP_FUNCTIONS_SYSTEM_INSTEAD__
     70#define strndup         __PLEASE_USE_THE_GLIB_STRDUP_FUNCTIONS_SYSTEM__
    7171#undef snprintf
    72 #define snprintf        __PLEASE_USE_G_SNPRINTF_INSTEAD__
     72#define snprintf        __PLEASE_USE_G_SNPRINTF__
    7373#undef strcasecmp
    74 #define strcasecmp      __PLEASE_USE_G_STRCASECMP_INSTEAD__
     74#define strcasecmp      __PLEASE_USE_G_STRCASECMP__
    7575#undef strncasecmp
    76 #define strncasecmp     __PLEASE_USE_G_STRNCASECMP_INSTEAD__
     76#define strncasecmp     __PLEASE_USE_G_STRNCASECMP__
     77
     78/* And the following functions shouldn't be used anymore to keep compatibility
     79   with other event handling libs than GLib. */
     80#undef g_timeout_add
     81#define g_timeout_add           __PLEASE_USE_B_TIMEOUT_ADD__
     82#undef g_timeout_add_full
     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__
     88#undef g_source_remove
     89#define g_source_remove         __PLEASE_USE_B_EVENT_REMOVE__
     90#undef g_source_remove_by_user_data
     91#define g_source_remove_by_user_data    __PLEASE_USE_B_SOURCE_REMOVE_BY_USER_DATA__
     92#undef g_main_run
     93#define g_main_run              __PLEASE_USE_B_MAIN_RUN__
     94#undef g_main_quit
     95#define g_main_quit             __PLEASE_USE_B_MAIN_QUIT__
    7796
    7897#ifndef F_OK
     
    112131#include "sock.h"
    113132#include "util.h"
     133#include "proxy.h"
    114134
    115135typedef struct global {
     
    121141        GList *storage; /* The first backend in the list will be used for saving */
    122142        char *helpfile;
    123         GMainLoop *loop;
    124143        int restart;
    125144} global_t;
     
    128147int bitlbee_inetd_init( void );
    129148
    130 gboolean bitlbee_io_current_client_read( GIOChannel *source, GIOCondition condition, gpointer data );
    131 gboolean bitlbee_io_current_client_write( GIOChannel *source, GIOCondition condition, gpointer data );
     149gboolean bitlbee_io_current_client_read( gpointer data, gint source, b_input_condition cond );
     150gboolean bitlbee_io_current_client_write( gpointer data, gint source, b_input_condition cond );
    132151
    133152void root_command_string( irc_t *irc, user_t *u, char *command, int flags );
    134153void root_command( irc_t *irc, char *command[] );
    135 void bitlbee_shutdown( gpointer data );
     154gboolean bitlbee_shutdown( gpointer data, gint fd, b_input_condition cond );
    136155
    137156extern global_t global;
  • configure

    r3af70b0 rb72caac  
    1414datadir='$prefix/share/bitlbee/'
    1515config='/var/lib/bitlbee/'
     16plugindir='$prefix/lib/bitlbee/'
     17includedir='$prefix/include/bitlbee/'
     18libevent='/usr/'
    1619pidfile='/var/run/bitlbee.pid'
    1720ipcsocket='/var/run/bitlbee'
    18 plugindir='$prefix/lib/bitlbee'
    1921pcdir='$prefix/lib/pkgconfig'
    20 includedir='$prefix/include/bitlbee'
    2122
    2223msn=1
     
    2829strip=1
    2930ipv6=1
     31
     32events=glib
    3033ssl=auto
    3134
     
    6467--ipv6=0/1      IPv6 socket support                     $ipv6
    6568
     69--events=...    Event handler (glib, libevent)          $events
    6670--ssl=...       SSL library to use (gnutls, nss, openssl, bogus, auto)
    6771                                                        $ssl
     
    8084config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'`
    8185plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'`
     86includedir=`eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g'`
     87libevent=`eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g'`
     88
    8289pidfile=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'`
    8390ipcsocket=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'`
    84 includedir=`eval echo "$includedir" | sed 's/\/\{1,\}/\//g'`
    8591pcdir=`eval echo "$pcdir" | sed 's/\/\{1,\}/\//g'`
    8692
     
    173179fi
    174180
     181if [ "$events" = "libevent" ]; then
     182        if ! [ -e "${libevent}include/event.h" ]; then
     183                echo
     184                echo 'Warning: Could not find event.h, you might have to install it and/or specify'
     185                echo 'its location using the --libevent= argument. (Example: If event.h is in'
     186                echo '/usr/local/include and binaries are in /usr/local/lib: --libevent=/usr/local)'
     187        fi
     188       
     189        echo '#define EVENTS_LIBEVENT' >> config.h
     190        cat <<EOF>>Makefile.settings
     191EFLAGS+=-levent -L${libevent}lib
     192CFLAGS+=-I${libevent}include
     193EOF
     194elif [ "$events" = "glib" ]; then
     195        ## We already use glib anyway, so this is all we need (and in fact not even this, but just to be sure...):
     196        echo '#define EVENTS_GLIB' >> config.h
     197else
     198        echo
     199        echo 'ERROR: Unknown event handler specified.'
     200        exit 1
     201fi
     202echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings
     203
    175204detect_gnutls()
    176205{
     
    401430fi
    402431
    403 if [ "$msn" = "1" ]; then
    404         echo '  Using SSL library: '$ssl;
    405 fi
     432echo '  Using event handler: '$events;
     433echo '  Using SSL library: '$ssl;
    406434
    407435#if [ "$flood" = "0" ]; then
  • ipc.c

    r3af70b0 rb72caac  
    6060                ipc_to_children_str( "DIE\r\n" );
    6161       
    62         bitlbee_shutdown( NULL );
     62        bitlbee_shutdown( NULL, -1, 0 );
    6363}
    6464
     
    9191       
    9292        global.restart = -1;
    93         bitlbee_shutdown( NULL );
     93        bitlbee_shutdown( NULL, -1, 0 );
    9494}
    9595
     
    246246}
    247247
    248 void ipc_master_read( gpointer data, gint source, GaimInputCondition cond )
     248gboolean ipc_master_read( gpointer data, gint source, b_input_condition cond )
    249249{
    250250        char *buf, **cmd;
     
    272272                }
    273273        }
    274 }
    275 
    276 void ipc_child_read( gpointer data, gint source, GaimInputCondition cond )
     274       
     275        return TRUE;
     276}
     277
     278gboolean ipc_child_read( gpointer data, gint source, b_input_condition cond )
    277279{
    278280        char *buf, **cmd;
     
    286288        else
    287289        {
    288                 gaim_input_remove( global.listen_watch_source_id );
     290                b_event_remove( global.listen_watch_source_id );
    289291                close( global.listen_socket );
    290292               
    291293                global.listen_socket = -1;
    292294        }
     295       
     296        return TRUE;
    293297}
    294298
     
    397401void ipc_master_free_one( struct bitlbee_child *c )
    398402{
    399         gaim_input_remove( c->ipc_inpa );
     403        b_event_remove( c->ipc_inpa );
    400404        closesocket( c->ipc_fd );
    401405       
     
    463467
    464468
    465 static gboolean new_ipc_client (GIOChannel *gio, GIOCondition cond, gpointer data)
     469static gboolean new_ipc_client( gpointer data, gint serversock, b_input_condition cond )
    466470{
    467471        struct bitlbee_child *child = g_new0( struct bitlbee_child, 1 );
    468         int serversock;
    469 
    470         serversock = g_io_channel_unix_get_fd(gio);
    471 
    472         child->ipc_fd = accept(serversock, NULL, 0);
    473 
    474         if (child->ipc_fd == -1) {
     472       
     473        child->ipc_fd = accept( serversock, NULL, 0 );
     474       
     475        if( child->ipc_fd == -1 )
     476        {
    475477                log_message( LOGLVL_WARNING, "Unable to accept connection on UNIX domain socket: %s", strerror(errno) );
    476478                return TRUE;
    477479        }
    478480               
    479         child->ipc_inpa = gaim_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
    480                
     481        child->ipc_inpa = b_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
     482       
    481483        child_list = g_slist_append( child_list, child );
    482 
     484       
    483485        return TRUE;
    484486}
     
    489491        struct sockaddr_un un_addr;
    490492        int serversock;
    491         GIOChannel *gio;
    492493
    493494        /* Clean up old socket files that were hanging around.. */
     
    517518        }
    518519       
    519         gio = g_io_channel_unix_new(serversock);
    520        
    521         if (gio == NULL) {
    522                 log_message( LOGLVL_WARNING, "Unable to create IO channel for unix socket" );
    523                 return 0;
    524         }
    525 
    526         g_io_add_watch(gio, G_IO_IN, new_ipc_client, NULL);
     520        b_input_add( serversock, GAIM_INPUT_READ, new_ipc_client, NULL );
     521       
    527522        return 1;
    528523}
     
    563558                        return 0;
    564559                }
    565                 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 );
    566561               
    567562                child_list = g_slist_append( child_list, child );
  • ipc.h

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

    r3af70b0 rb72caac  
    2929#include "ipc.h"
    3030
    31 static gboolean irc_userping( gpointer _irc );
     31static gboolean irc_userping( gpointer _irc, int fd, b_input_condition cond );
    3232
    3333GSList *irc_connection_list = NULL;
     
    5454       
    5555        irc->fd = fd;
    56         irc->io_channel = g_io_channel_unix_new( fd );
    57         g_io_channel_set_encoding (irc->io_channel, NULL, NULL);
    58         g_io_channel_set_buffered (irc->io_channel, FALSE);
    59         g_io_channel_set_flags( irc->io_channel, G_IO_FLAG_NONBLOCK, NULL );
    60         irc->r_watch_source_id = g_io_add_watch( irc->io_channel, G_IO_IN | G_IO_ERR | G_IO_HUP, bitlbee_io_current_client_read, irc );
     56        sock_make_nonblocking( irc->fd );
     57       
     58        irc->r_watch_source_id = b_input_add( irc->fd, GAIM_INPUT_READ, bitlbee_io_current_client_read, irc );
    6159       
    6260        irc->status = USTATUS_OFFLINE;
     
    116114
    117115        if( global.conf->ping_interval > 0 && global.conf->ping_timeout > 0 )
    118                 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 );
    119117       
    120118        irc_write( irc, ":%s NOTICE AUTH :%s", irc->myhost, "BitlBee-IRCd initialized, please go on" );
     
    186184                   bitlbee_.._write doesn't do it first. */
    187185               
    188                 g_source_remove( irc->r_watch_source_id );
    189                 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 );
    190188        }
    191189        else
     
    220218       
    221219        if( irc->ping_source_id > 0 )
    222                 g_source_remove( irc->ping_source_id );
    223         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 );
    224222        if( irc->w_watch_source_id > 0 )
    225                 g_source_remove( irc->w_watch_source_id );
    226        
    227         g_io_channel_unref( irc->io_channel );
     223                b_event_remove( irc->w_watch_source_id );
     224       
    228225        irc_connection_list = g_slist_remove( irc_connection_list, irc );
    229226       
     
    275272                        if(user->host!=user->nick) g_free(user->host);
    276273                        if(user->realname!=user->nick) g_free(user->realname);
    277                         gaim_input_remove(user->sendbuf_timer);
     274                        b_event_remove(user->sendbuf_timer);
    278275                                       
    279276                        usertmp = user;
     
    325322       
    326323        if( global.conf->runmode == RUNMODE_INETD || global.conf->runmode == RUNMODE_FORKDAEMON )
    327                 g_main_quit( global.loop );
     324                b_main_quit();
    328325}
    329326
     
    579576        char line[IRC_MAX_LINE+1], *cs;
    580577               
    581         if( irc->quit )
     578        /* Don't try to write anything new anymore when shutting down. */
     579        if( irc->status == USTATUS_SHUTDOWN )
    582580                return;
    583581       
     
    596594        strcat( line, "\r\n" );
    597595       
    598         if( irc->sendbuffer != NULL ) {
     596        if( irc->sendbuffer != NULL )
     597        {
    599598                size = strlen( irc->sendbuffer ) + strlen( line );
    600599                irc->sendbuffer = g_renew ( char, irc->sendbuffer, size + 1 );
    601600                strcpy( ( irc->sendbuffer + strlen( irc->sendbuffer ) ), line );
    602601        }
    603         else
    604                 irc->sendbuffer = g_strdup(line);       
     602        else
     603        {
     604                irc->sendbuffer = g_strdup(line);
     605        }
    605606       
    606607        if( irc->w_watch_source_id == 0 )
    607608        {
    608                 irc->w_watch_source_id = g_io_add_watch( irc->io_channel, G_IO_OUT, bitlbee_io_current_client_write, irc );
     609                /* If the buffer is empty we can probably write, so call the write event handler
     610                   immediately. If it returns TRUE, it should be called again, so add the event to
     611                   the queue. If it's FALSE, we emptied the buffer and saved ourselves some work
     612                   in the event queue. */
     613                if( bitlbee_io_current_client_write( irc, irc->fd, GAIM_INPUT_WRITE ) )
     614                        irc->w_watch_source_id = b_input_add( irc->fd, GAIM_INPUT_WRITE, bitlbee_io_current_client_write, irc );
    609615        }
    610616       
     
    632638                if( now )
    633639                {
    634                         bitlbee_io_current_client_write( irc->io_channel, G_IO_OUT, irc );
     640                        bitlbee_io_current_client_write( irc, irc->fd, GAIM_INPUT_WRITE );
    635641                }
    636642                temp = temp->next;
     
    10351041}
    10361042
    1037 gboolean buddy_send_handler_delayed( gpointer data )
     1043static gboolean buddy_send_handler_delayed( gpointer data, gint fd, b_input_condition cond )
    10381044{
    10391045        user_t *u = data;
     
    10661072                {
    10671073                        /* Flush the buffer */
    1068                         g_source_remove( u->sendbuf_timer );
    1069                         buddy_send_handler_delayed( u );
     1074                        b_event_remove( u->sendbuf_timer );
     1075                        buddy_send_handler_delayed( u, -1, 0 );
    10701076                }
    10711077
     
    10911097               
    10921098                if( u->sendbuf_timer > 0 )
    1093                         g_source_remove( u->sendbuf_timer );
    1094                 u->sendbuf_timer = g_timeout_add( delay, buddy_send_handler_delayed, u );
     1099                        b_event_remove( u->sendbuf_timer );
     1100                u->sendbuf_timer = b_timeout_add( delay, buddy_send_handler_delayed, u );
    10951101        }
    10961102        else
     
    11761182   pongs from the user. When not connected yet, we don't ping but drop the
    11771183   connection when the user fails to connect in IRC_LOGIN_TIMEOUT secs. */
    1178 static gboolean irc_userping( gpointer _irc )
     1184static gboolean irc_userping( gpointer _irc, gint fd, b_input_condition cond )
    11791185{
    11801186        irc_t *irc = _irc;
  • irc.h

    r3af70b0 rb72caac  
    6161        char *sendbuffer;
    6262        char *readbuffer;
    63         int quit;
    6463
    6564        int sentbytes;
     
    9392        struct set *set;
    9493
    95         GIOChannel *io_channel;
    9694        gint r_watch_source_id;
    9795        gint w_watch_source_id;
  • protocols/Makefile

    r3af70b0 rb72caac  
    1010
    1111# [SH] Program variables
    12 objects = http_client.o md5.o nogaim.o proxy.o sha.o $(SSL_CLIENT)
     12objects = $(EVENT_HANDLER) http_client.o md5.o nogaim.o proxy.o sha.o $(SSL_CLIENT)
    1313
    1414# [SH] The next two lines should contain the directory name (in $(subdirs))
  • protocols/http_client.c

    r3af70b0 rb72caac  
    3232
    3333
    34 static void http_connected( gpointer data, int source, GaimInputCondition cond );
    35 static void http_ssl_connected( gpointer data, void *source, GaimInputCondition cond );
    36 static void http_incoming_data( gpointer data, int source, GaimInputCondition cond );
     34static gboolean http_connected( gpointer data, int source, b_input_condition cond );
     35static gboolean http_ssl_connected( gpointer data, void *source, b_input_condition cond );
     36static gboolean http_incoming_data( gpointer data, int source, b_input_condition cond );
    3737
    3838
     
    104104/* This one is actually pretty simple... Might get more calls if we can't write
    105105   the whole request at once. */
    106 static void http_connected( gpointer data, int source, GaimInputCondition cond )
     106static gboolean http_connected( gpointer data, int source, b_input_condition cond )
    107107{
    108108        struct http_request *req = data;
     
    113113       
    114114        if( req->inpa > 0 )
    115                 gaim_input_remove( req->inpa );
     115                b_event_remove( req->inpa );
    116116       
    117117        sock_make_nonblocking( req->fd );
     
    148148       
    149149        if( req->bytes_written < req->request_length )
    150                 req->inpa = gaim_input_add( source,
    151                                             req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_WRITE,
    152                                             http_connected, req );
    153         else
    154                 req->inpa = gaim_input_add( source, GAIM_INPUT_READ, http_incoming_data, req );
    155        
    156         return;
     150                req->inpa = b_input_add( source,
     151                                         req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_WRITE,
     152                                         http_connected, req );
     153        else
     154                req->inpa = b_input_add( source, GAIM_INPUT_READ, http_incoming_data, req );
     155       
     156        return FALSE;
    157157       
    158158error:
     
    164164        g_free( req );
    165165       
    166         return;
     166        return FALSE;
    167167}
    168168
    169 static void http_ssl_connected( gpointer data, void *source, GaimInputCondition cond )
     169static gboolean http_ssl_connected( gpointer data, void *source, b_input_condition cond )
    170170{
    171171        struct http_request *req = data;
     
    179179}
    180180
    181 static void http_incoming_data( gpointer data, int source, GaimInputCondition cond )
     181static gboolean http_incoming_data( gpointer data, int source, b_input_condition cond )
    182182{
    183183        struct http_request *req = data;
     
    188188       
    189189        if( req->inpa > 0 )
    190                 gaim_input_remove( req->inpa );
     190                b_event_remove( req->inpa );
    191191       
    192192        if( req->ssl )
     
    236236       
    237237        /* There will be more! */
    238         req->inpa = gaim_input_add( req->fd,
    239                                     req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_READ,
    240                                     http_incoming_data, req );
    241        
    242         return;
     238        req->inpa = b_input_add( req->fd,
     239                                 req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_READ,
     240                                 http_incoming_data, req );
     241       
     242        return FALSE;
    243243
    244244got_reply:
     
    430430                req->reply_headers = req->reply_body = NULL;
    431431               
    432                 return;
     432                return FALSE;
    433433        }
    434434       
     
    449449        g_free( req->status_string );
    450450        g_free( req );
     451       
     452        return FALSE;
    451453}
  • protocols/jabber/jabber.c

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

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

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

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

    r3af70b0 rb72caac  
    22  * BitlBee -- An IRC to other IM-networks gateway                     *
    33  *                                                                    *
    4   * Copyright 2002-2004 Wilmer van der Gaast and others                *
     4  * Copyright 2002-2006 Wilmer van der Gaast and others                *
    55  \********************************************************************/
    66
     
    1313 * from scratch for BitlBee and doesn't contain any code from Gaim anymore
    1414 * (except for the function names).
    15  *
    16  * Copyright 2002-2006 Wilmer van der Gaast <wilmer@gaast.net> and others
    1715 */
    1816
     
    160158         * This fixes daemon mode breakage where IRC doesn't point to the currently active connection.
    161159         */
    162         gc->irc=user->irc;
     160        gc->irc = user->irc;
    163161       
    164162        connections = g_slist_append( connections, gc );
     
    240238}
    241239
    242 static gboolean send_keepalive( gpointer d )
     240static gboolean send_keepalive( gpointer d, gint fd, b_input_condition cond )
    243241{
    244242        struct gaim_connection *gc = d;
     
    264262        serv_got_crap( gc, "Logged in" );
    265263       
    266         gc->keepalive = g_timeout_add( 60000, send_keepalive, gc );
     264        gc->keepalive = b_timeout_add( 60000, send_keepalive, gc );
    267265        gc->flags |= OPT_LOGGED_IN;
    268266       
     
    272270}
    273271
    274 gboolean auto_reconnect( gpointer data )
     272gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond )
    275273{
    276274        account_t *a = data;
     
    284282void cancel_auto_reconnect( account_t *a )
    285283{
    286         while( g_source_remove_by_user_data( (gpointer) a ) );
     284        /* while( b_event_remove_by_data( (gpointer) a ) ); */
     285        b_event_remove( a->reconnect );
    287286        a->reconnect = 0;
    288287}
     
    295294       
    296295        serv_got_crap( gc, "Signing off.." );
     296       
     297        b_event_remove( gc->keepalive );
    297298        gc->flags |= OPT_LOGGING_OUT;
    298        
    299         gaim_input_remove( gc->keepalive );
    300299        gc->keepalive = 0;
    301300        gc->prpl->close( gc );
    302         gaim_input_remove( gc->inpa );
     301        b_event_remove( gc->inpa );
    303302       
    304303        while( u )
     
    327326        {
    328327                int delay = set_getint( irc, "auto_reconnect_delay" );
     328               
    329329                serv_got_crap( gc, "Reconnecting in %d seconds..", delay );
    330                
    331                 a->reconnect = 1;
    332                 g_timeout_add( delay * 1000, auto_reconnect, a );
     330                a->reconnect = b_timeout_add( delay * 1000, auto_reconnect, a );
    333331        }
    334332       
  • protocols/nogaim.h

    r3af70b0 rb72caac  
    208208char *set_eval_away_devoice( irc_t *irc, set_t *set, char *value );
    209209
    210 gboolean auto_reconnect( gpointer data );
     210gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond );
    211211void cancel_auto_reconnect( struct account *a );
    212212
  • protocols/oscar/oscar.c

    r3af70b0 rb72caac  
    255255static int msgerrreasonlen = 25;
    256256
    257 static void oscar_callback(gpointer data, gint source,
    258                                 GaimInputCondition condition) {
     257static gboolean oscar_callback(gpointer data, gint source,
     258                                b_input_condition condition) {
    259259        aim_conn_t *conn = (aim_conn_t *)data;
    260260        aim_session_t *sess = aim_conn_getsess(conn);
     
    264264        if (!gc) {
    265265                /* gc is null. we return, else we seg SIGSEG on next line. */
    266                 return;
     266                return FALSE;
    267267        }
    268268     
     
    270270                /* oh boy. this is probably bad. i guess the only thing we
    271271                 * can really do is return? */
    272                 return;
     272                return FALSE;
    273273        }
    274274
     
    290290                                c->conn = NULL;
    291291                                if (c->inpa > 0)
    292                                         gaim_input_remove(c->inpa);
     292                                        b_event_remove(c->inpa);
    293293                                c->inpa = 0;
    294294                                c->fd = -1;
     
    298298                        } else if (conn->type == AIM_CONN_TYPE_CHATNAV) {
    299299                                if (odata->cnpa > 0)
    300                                         gaim_input_remove(odata->cnpa);
     300                                        b_event_remove(odata->cnpa);
    301301                                odata->cnpa = 0;
    302302                                while (odata->create_rooms) {
     
    312312                        } else if (conn->type == AIM_CONN_TYPE_AUTH) {
    313313                                if (odata->paspa > 0)
    314                                         gaim_input_remove(odata->paspa);
     314                                        b_event_remove(odata->paspa);
    315315                                odata->paspa = 0;
    316316                                aim_conn_kill(odata->sess, &conn);
     
    319319                        }
    320320                }
    321         }
    322 }
    323 
    324 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond)
     321        } else {
     322                /* WTF??? */
     323                return FALSE;
     324        }
     325               
     326        return TRUE;
     327}
     328
     329static gboolean oscar_login_connect(gpointer data, gint source, b_input_condition cond)
    325330{
    326331        struct gaim_connection *gc = data;
     
    331336        if (!g_slist_find(get_connections(), gc)) {
    332337                closesocket(source);
    333                 return;
     338                return FALSE;
    334339        }
    335340
     
    341346                hide_login_progress(gc, _("Couldn't connect to host"));
    342347                signoff(gc);
    343                 return;
     348                return FALSE;
    344349        }
    345350
    346351        aim_conn_completeconnect(sess, conn);
    347         gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ,
     352        gc->inpa = b_input_add(conn->fd, GAIM_INPUT_READ,
    348353                        oscar_callback, conn);
     354       
     355        return FALSE;
    349356}
    350357
     
    414421                struct chat_connection *n = odata->oscar_chats->data;
    415422                if (n->inpa > 0)
    416                         gaim_input_remove(n->inpa);
     423                        b_event_remove(n->inpa);
    417424                g_free(n->name);
    418425                g_free(n->show);
     
    433440                g_free(odata->oldp);
    434441        if (gc->inpa > 0)
    435                 gaim_input_remove(gc->inpa);
     442                b_event_remove(gc->inpa);
    436443        if (odata->cnpa > 0)
    437                 gaim_input_remove(odata->cnpa);
     444                b_event_remove(odata->cnpa);
    438445        if (odata->paspa > 0)
    439                 gaim_input_remove(odata->paspa);
     446                b_event_remove(odata->paspa);
    440447        aim_session_kill(odata->sess);
    441448        g_free(odata->sess);
     
    445452}
    446453
    447 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) {
     454static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition cond) {
    448455        struct gaim_connection *gc = data;
    449456        struct oscar_data *odata;
     
    453460        if (!g_slist_find(get_connections(), gc)) {
    454461                closesocket(source);
    455                 return;
     462                return FALSE;
    456463        }
    457464
     
    463470                hide_login_progress(gc, _("Could Not Connect"));
    464471                signoff(gc);
    465                 return;
     472                return FALSE;
    466473        }
    467474
    468475        aim_conn_completeconnect(sess, bosconn);
    469         gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ,
     476        gc->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,
    470477                        oscar_callback, bosconn);
    471478        set_login_progress(gc, 4, _("Connection established, cookie sent"));
     479       
     480        return FALSE;
    472481}
    473482
     
    572581        }
    573582        aim_sendcookie(sess, bosconn, info->cookie);
    574         gaim_input_remove(gc->inpa);
     583        b_event_remove(gc->inpa);
    575584
    576585        return 1;
     
    587596};
    588597
    589 static void damn_you(gpointer data, gint source, GaimInputCondition c)
     598static gboolean damn_you(gpointer data, gint source, b_input_condition c)
    590599{
    591600        struct pieceofcrap *pos = data;
     
    607616                do_error_dialog(pos->gc, "Gaim was unable to get a valid hash for logging into AIM."
    608617                                " You may be disconnected shortly.", "Login Error");
    609                 gaim_input_remove(pos->inpa);
     618                b_event_remove(pos->inpa);
    610619                closesocket(pos->fd);
    611620                g_free(pos);
    612                 return;
     621                return FALSE;
    613622        }
    614623        /* [WvG] Wheeeee! Who needs error checking anyway? ;-) */
    615624        read(pos->fd, m, 16);
    616625        m[16] = '\0';
    617         gaim_input_remove(pos->inpa);
     626        b_event_remove(pos->inpa);
    618627        closesocket(pos->fd);
    619628        aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH);
    620629        g_free(pos);
    621 }
    622 
    623 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) {
     630       
     631        return FALSE;
     632}
     633
     634static gboolean straight_to_hell(gpointer data, gint source, b_input_condition cond) {
    624635        struct pieceofcrap *pos = data;
    625636        char buf[BUF_LONG];
     
    631642                        g_free(pos->modname);
    632643                g_free(pos);
    633                 return;
     644                return FALSE;
    634645        }
    635646
     
    640651        if (pos->modname)
    641652                g_free(pos->modname);
    642         pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);
    643         return;
     653        pos->inpa = b_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);
     654        return FALSE;
    644655}
    645656
     
    763774}
    764775
    765 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) {
     776static gboolean oscar_chatnav_connect(gpointer data, gint source, b_input_condition cond) {
    766777        struct gaim_connection *gc = data;
    767778        struct oscar_data *odata;
     
    771782        if (!g_slist_find(get_connections(), gc)) {
    772783                closesocket(source);
    773                 return;
     784                return FALSE;
    774785        }
    775786
     
    780791        if (source < 0) {
    781792                aim_conn_kill(sess, &tstconn);
    782                 return;
     793                return FALSE;
    783794        }
    784795
    785796        aim_conn_completeconnect(sess, tstconn);
    786         odata->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,
     797        odata->cnpa = b_input_add(tstconn->fd, GAIM_INPUT_READ,
    787798                                        oscar_callback, tstconn);
    788 }
    789 
    790 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond)
     799       
     800        return FALSE;
     801}
     802
     803static gboolean oscar_auth_connect(gpointer data, gint source, b_input_condition cond)
    791804{
    792805        struct gaim_connection *gc = data;
     
    797810        if (!g_slist_find(get_connections(), gc)) {
    798811                closesocket(source);
    799                 return;
     812                return FALSE;
    800813        }
    801814
     
    806819        if (source < 0) {
    807820                aim_conn_kill(sess, &tstconn);
    808                 return;
     821                return FALSE;
    809822        }
    810823
    811824        aim_conn_completeconnect(sess, tstconn);
    812         odata->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,
     825        odata->paspa = b_input_add(tstconn->fd, GAIM_INPUT_READ,
    813826                                oscar_callback, tstconn);
    814 }
    815 
    816 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond)
     827       
     828        return FALSE;
     829}
     830
     831static gboolean oscar_chat_connect(gpointer data, gint source, b_input_condition cond)
    817832{
    818833        struct chat_connection *ccon = data;
     
    827842                g_free(ccon->name);
    828843                g_free(ccon);
    829                 return;
     844                return FALSE;
    830845        }
    831846
     
    839854                g_free(ccon->name);
    840855                g_free(ccon);
    841                 return;
     856                return FALSE;
    842857        }
    843858
    844859        aim_conn_completeconnect(sess, ccon->conn);
    845         ccon->inpa = gaim_input_add(tstconn->fd,
     860        ccon->inpa = b_input_add(tstconn->fd,
    846861                        GAIM_INPUT_READ,
    847862                        oscar_callback, tstconn);
    848863        odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon);
     864       
     865        return FALSE;
    849866}
    850867
     
    25652582        od->oscar_chats = g_slist_remove(od->oscar_chats, cc);
    25662583        if (cc->inpa > 0)
    2567                 gaim_input_remove(cc->inpa);
     2584                b_event_remove(cc->inpa);
    25682585        aim_conn_kill(od->sess, &cc->conn);
    25692586        g_free(cc->name);
  • protocols/proxy.c

    r3af70b0 rb72caac  
    2121 */
    2222
    23 /* this is a little piece of code to handle proxy connection */
    24 /* it is intended to : 1st handle http proxy, using the CONNECT command
    25  , 2nd provide an easy way to add socks support */
    26 
    2723#define BITLBEE_CORE
    2824#include <stdio.h>
     
    4642#include "proxy.h"
    4743
    48 #define GAIM_READ_COND  (G_IO_IN | G_IO_HUP | G_IO_ERR)
    49 #define GAIM_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL)
    50 #define GAIM_ERR_COND   (G_IO_HUP | G_IO_ERR | G_IO_NVAL)
    51 
    5244char proxyhost[128] = "";
    5345int proxyport = 0;
     
    5749
    5850struct PHB {
    59         GaimInputFunction func, proxy_func;
     51        b_event_handler func, proxy_func;
    6052        gpointer data, proxy_data;
    6153        char *host;
     
    6456        gint inpa;
    6557};
    66 
    67 typedef struct _GaimIOClosure {
    68         GaimInputFunction function;
    69         guint result;
    70         gpointer data;
    71 } GaimIOClosure;
    7258
    7359
     
    9278}
    9379
    94 static void gaim_io_destroy(gpointer data)
    95 {
    96         g_free(data);
    97 }
    98 
    99 static gboolean gaim_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data)
    100 {
    101         GaimIOClosure *closure = data;
    102         GaimInputCondition gaim_cond = 0;
    103 
    104         if (condition & GAIM_READ_COND)
    105                 gaim_cond |= GAIM_INPUT_READ;
    106         if (condition & GAIM_WRITE_COND)
    107                 gaim_cond |= GAIM_INPUT_WRITE;
    108 
    109         closure->function(closure->data, g_io_channel_unix_get_fd(source), gaim_cond);
    110 
    111         return TRUE;
    112 }
    113 
    114 static void gaim_io_connected(gpointer data, gint source, GaimInputCondition cond)
     80static gboolean gaim_io_connected(gpointer data, gint source, b_input_condition cond)
    11581{
    11682        struct PHB *phb = data;
     
    12288        if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
    12389                closesocket(source);
    124                 gaim_input_remove(phb->inpa);
     90                b_event_remove(phb->inpa);
    12591                if( phb->proxy_func )
    12692                        phb->proxy_func(phb->proxy_data, -1, GAIM_INPUT_READ);
     
    12995                        g_free(phb);
    13096                }
    131                 return;
     97                return FALSE;
    13298        }
    13399#endif
    134100        sock_make_blocking(source);
    135         gaim_input_remove(phb->inpa);
     101        b_event_remove(phb->inpa);
    136102        if( phb->proxy_func )
    137103                phb->proxy_func(phb->proxy_data, source, GAIM_INPUT_READ);
     
    140106                g_free(phb);
    141107        }
     108       
     109        return FALSE;
    142110}
    143111
     
    158126
    159127        sock_make_nonblocking(fd);
    160 
     128       
     129        event_debug("proxy_connect_none( \"%s\", %d ) = %d\n", host, port, fd);
     130       
    161131        if (connect(fd, (struct sockaddr *)sin, sizeof(*sin)) < 0) {
    162132                if (sockerr_again()) {
    163                         phb->inpa = gaim_input_add(fd, GAIM_INPUT_WRITE, gaim_io_connected, phb);
     133                        phb->inpa = b_input_add(fd, GAIM_INPUT_WRITE, gaim_io_connected, phb);
    164134                        phb->fd = fd;
    165135                } else {
     
    179149#define HTTP_GOODSTRING2 "HTTP/1.1 200 Connection established"
    180150
    181 static void http_canread(gpointer data, gint source, GaimInputCondition cond)
     151static gboolean http_canread(gpointer data, gint source, b_input_condition cond)
    182152{
    183153        int nlc = 0;
     
    186156        char inputline[8192];
    187157
    188         gaim_input_remove(phb->inpa);
     158        b_event_remove(phb->inpa);
    189159
    190160        while ((pos < sizeof(inputline)-1) && (nlc != 2) && (read(source, &inputline[pos++], 1) == 1)) {
     
    201171                g_free(phb->host);
    202172                g_free(phb);
    203                 return;
     173                return FALSE;
    204174        }
    205175
     
    208178        g_free(phb->host);
    209179        g_free(phb);
    210         return;
    211 }
    212 
    213 static void http_canwrite(gpointer data, gint source, GaimInputCondition cond)
     180       
     181        return FALSE;
     182}
     183
     184static gboolean http_canwrite(gpointer data, gint source, b_input_condition cond)
    214185{
    215186        char cmd[384];
     
    218189        int error = ETIMEDOUT;
    219190        if (phb->inpa > 0)
    220                 gaim_input_remove(phb->inpa);
     191                b_event_remove(phb->inpa);
    221192        len = sizeof(error);
    222193        if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
     
    225196                g_free(phb->host);
    226197                g_free(phb);
    227                 return;
     198                return FALSE;
    228199        }
    229200        sock_make_blocking(source);
     
    236207                g_free(phb->host);
    237208                g_free(phb);
    238                 return;
     209                return FALSE;
    239210        }
    240211
     
    251222                        g_free(phb->host);
    252223                        g_free(phb);
    253                         return;
     224                        return FALSE;
    254225                }
    255226        }
     
    261232                g_free(phb->host);
    262233                g_free(phb);
    263                 return;
    264         }
    265 
    266         phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, http_canread, phb);
     234                return FALSE;
     235        }
     236
     237        phb->inpa = b_input_add(source, GAIM_INPUT_READ, http_canread, phb);
     238       
     239        return FALSE;
    267240}
    268241
     
    280253/* Connecting to SOCKS4 proxies */
    281254
    282 static void s4_canread(gpointer data, gint source, GaimInputCondition cond)
     255static gboolean s4_canread(gpointer data, gint source, b_input_condition cond)
    283256{
    284257        unsigned char packet[12];
    285258        struct PHB *phb = data;
    286259
    287         gaim_input_remove(phb->inpa);
     260        b_event_remove(phb->inpa);
    288261
    289262        memset(packet, 0, sizeof(packet));
     
    292265                g_free(phb->host);
    293266                g_free(phb);
    294                 return;
     267                return FALSE;
    295268        }
    296269
     
    299272        g_free(phb->host);
    300273        g_free(phb);
    301 }
    302 
    303 static void s4_canwrite(gpointer data, gint source, GaimInputCondition cond)
     274       
     275        return FALSE;
     276}
     277
     278static gboolean s4_canwrite(gpointer data, gint source, b_input_condition cond)
    304279{
    305280        unsigned char packet[12];
     
    309284        int error = ETIMEDOUT;
    310285        if (phb->inpa > 0)
    311                 gaim_input_remove(phb->inpa);
     286                b_event_remove(phb->inpa);
    312287        len = sizeof(error);
    313288        if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
     
    316291                g_free(phb->host);
    317292                g_free(phb);
    318                 return;
     293                return FALSE;
    319294        }
    320295        sock_make_blocking(source);
     
    326301                g_free(phb->host);
    327302                g_free(phb);
    328                 return;
     303                return FALSE;
    329304        }
    330305
     
    343318                g_free(phb->host);
    344319                g_free(phb);
    345                 return;
    346         }
    347 
    348         phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, s4_canread, phb);
     320                return FALSE;
     321        }
     322
     323        phb->inpa = b_input_add(source, GAIM_INPUT_READ, s4_canread, phb);
     324       
     325        return FALSE;
    349326}
    350327
     
    362339/* Connecting to SOCKS5 proxies */
    363340
    364 static void s5_canread_again(gpointer data, gint source, GaimInputCondition cond)
     341static gboolean s5_canread_again(gpointer data, gint source, b_input_condition cond)
    365342{
    366343        unsigned char buf[512];
    367344        struct PHB *phb = data;
    368345
    369         gaim_input_remove(phb->inpa);
     346        b_event_remove(phb->inpa);
    370347
    371348        if (read(source, buf, 10) < 10) {
     
    374351                g_free(phb->host);
    375352                g_free(phb);
    376                 return;
     353                return FALSE;
    377354        }
    378355        if ((buf[0] != 0x05) || (buf[1] != 0x00)) {
     
    381358                g_free(phb->host);
    382359                g_free(phb);
    383                 return;
     360                return FALSE;
    384361        }
    385362
     
    387364        g_free(phb->host);
    388365        g_free(phb);
    389         return;
     366       
     367        return FALSE;
    390368}
    391369
     
    395373        struct PHB *phb = data;
    396374        int hlen = strlen(phb->host);
    397 
     375       
    398376        buf[0] = 0x05;
    399377        buf[1] = 0x01;          /* CONNECT */
     
    413391        }
    414392
    415         phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, s5_canread_again, phb);
    416 }
    417 
    418 static void s5_readauth(gpointer data, gint source, GaimInputCondition cond)
     393        phb->inpa = b_input_add(source, GAIM_INPUT_READ, s5_canread_again, phb);
     394}
     395
     396static gboolean s5_readauth(gpointer data, gint source, b_input_condition cond)
    419397{
    420398        unsigned char buf[512];
    421399        struct PHB *phb = data;
    422400
    423         gaim_input_remove(phb->inpa);
     401        b_event_remove(phb->inpa);
    424402
    425403        if (read(source, buf, 2) < 2) {
     
    428406                g_free(phb->host);
    429407                g_free(phb);
    430                 return;
     408                return FALSE;
    431409        }
    432410
     
    436414                g_free(phb->host);
    437415                g_free(phb);
    438                 return;
     416                return FALSE;
    439417        }
    440418
    441419        s5_sendconnect(phb, source);
    442 }
    443 
    444 static void s5_canread(gpointer data, gint source, GaimInputCondition cond)
     420       
     421        return FALSE;
     422}
     423
     424static gboolean s5_canread(gpointer data, gint source, b_input_condition cond)
    445425{
    446426        unsigned char buf[512];
    447427        struct PHB *phb = data;
    448428
    449         gaim_input_remove(phb->inpa);
     429        b_event_remove(phb->inpa);
    450430
    451431        if (read(source, buf, 2) < 2) {
     
    454434                g_free(phb->host);
    455435                g_free(phb);
    456                 return;
     436                return FALSE;
    457437        }
    458438
     
    462442                g_free(phb->host);
    463443                g_free(phb);
    464                 return;
     444                return FALSE;
    465445        }
    466446
     
    477457                        g_free(phb->host);
    478458                        g_free(phb);
    479                         return;
     459                        return FALSE;
    480460                }
    481461
    482                 phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, s5_readauth, phb);
     462                phb->inpa = b_input_add(source, GAIM_INPUT_READ, s5_readauth, phb);
    483463        } else {
    484464                s5_sendconnect(phb, source);
    485465        }
    486 }
    487 
    488 static void s5_canwrite(gpointer data, gint source, GaimInputCondition cond)
     466       
     467        return FALSE;
     468}
     469
     470static gboolean s5_canwrite(gpointer data, gint source, b_input_condition cond)
    489471{
    490472        unsigned char buf[512];
     
    494476        int error = ETIMEDOUT;
    495477        if (phb->inpa > 0)
    496                 gaim_input_remove(phb->inpa);
     478                b_event_remove(phb->inpa);
    497479        len = sizeof(error);
    498480        if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
     
    501483                g_free(phb->host);
    502484                g_free(phb);
    503                 return;
     485                return FALSE;
    504486        }
    505487        sock_make_blocking(source);
     
    523505                g_free(phb->host);
    524506                g_free(phb);
    525                 return;
    526         }
    527 
    528         phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, s5_canread, phb);
     507                return FALSE;
     508        }
     509
     510        phb->inpa = b_input_add(source, GAIM_INPUT_READ, s5_canread, phb);
     511       
     512        return FALSE;
    529513}
    530514
     
    542526/* Export functions */
    543527
    544 gint gaim_input_add(gint source, GaimInputCondition condition, GaimInputFunction function, gpointer data)
    545 {
    546         GaimIOClosure *closure = g_new0(GaimIOClosure, 1);
    547         GIOChannel *channel;
    548         GIOCondition cond = 0;
    549        
    550         closure->function = function;
    551         closure->data = data;
    552        
    553         if (condition & GAIM_INPUT_READ)
    554                 cond |= GAIM_READ_COND;
    555         if (condition & GAIM_INPUT_WRITE)
    556                 cond |= GAIM_WRITE_COND;
    557        
    558         channel = g_io_channel_unix_new(source);
    559         closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond,
    560                                               gaim_io_invoke, closure, gaim_io_destroy);
    561        
    562         g_io_channel_unref(channel);
    563         return closure->result;
    564 }
    565 
    566 void gaim_input_remove(gint tag)
    567 {
    568         if (tag > 0)
    569                 g_source_remove(tag);
    570 }
    571 
    572 int proxy_connect(const char *host, int port, GaimInputFunction func, gpointer data)
     528int proxy_connect(const char *host, int port, b_event_handler func, gpointer data)
    573529{
    574530        struct PHB *phb;
  • protocols/proxy.h

    r3af70b0 rb72caac  
    11/*
    2  * gaim
     2 * nogaim
    33 *
    44 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
     
    3636#include <gmodule.h>
    3737
     38#include "events.h"
     39
    3840#define PROXY_NONE 0
    3941#define PROXY_HTTP 1
     
    4749extern char proxypass[128];
    4850
    49 typedef enum {
    50         GAIM_INPUT_READ = 1 << 0,
    51         GAIM_INPUT_WRITE = 1 << 1
    52 } GaimInputCondition;
    53 typedef void (*GaimInputFunction)(gpointer, gint, GaimInputCondition);
    54 
    55 G_MODULE_EXPORT gint gaim_input_add(int, GaimInputCondition, GaimInputFunction, gpointer);
    56 G_MODULE_EXPORT void gaim_input_remove(gint);
    57 
    58 G_MODULE_EXPORT int proxy_connect(const char *host, int port, GaimInputFunction func, gpointer data);
     51G_MODULE_EXPORT int proxy_connect(const char *host, int port, b_event_handler func, gpointer data);
    5952
    6053#endif /* _PROXY_H_ */
  • protocols/ssl_bogus.c

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

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

    r3af70b0 rb72caac  
    4848};
    4949
    50 static void ssl_connected( gpointer data, gint source, GaimInputCondition cond );
     50static gboolean ssl_connected( gpointer data, gint source, b_input_condition cond );
    5151
    5252
     
    8181}
    8282
    83 static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond );
    84 
    85 static void ssl_connected( gpointer data, gint source, GaimInputCondition cond )
     83static gboolean ssl_handshake( gpointer data, gint source, b_input_condition cond );
     84
     85static gboolean ssl_connected( gpointer data, gint source, b_input_condition cond )
    8686{
    8787        struct scd *conn = data;
     
    9696                g_free( conn );
    9797               
    98                 return;
     98                return FALSE;
    9999        }
    100100       
     
    102102        gnutls_transport_set_ptr( conn->session, (gnutls_transport_ptr) conn->fd );
    103103       
    104         ssl_handshake( data, source, cond );
    105 }
    106 
    107 static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond )
     104        return ssl_handshake( data, source, cond );
     105}
     106
     107static gboolean ssl_handshake( gpointer data, gint source, b_input_condition cond )
    108108{
    109109        struct scd *conn = data;
    110110        int st;
    111111       
    112         if( conn->inpa != -1 )
    113         {
    114                 gaim_input_remove( conn->inpa );
    115                 conn->inpa = -1;
    116         }
    117        
    118112        if( ( st = gnutls_handshake( conn->session ) ) < 0 )
    119113        {
    120114                if( st == GNUTLS_E_AGAIN || st == GNUTLS_E_INTERRUPTED )
    121115                {
    122                         conn->inpa = gaim_input_add( conn->fd, ssl_getdirection( conn ),
    123                                                      ssl_handshake, data );
     116                        conn->inpa = b_input_add( conn->fd, ssl_getdirection( conn ),
     117                                                  ssl_handshake, data );
    124118                }
    125119                else
     
    142136                conn->func( conn->data, conn, cond );
    143137        }
     138       
     139        return FALSE;
    144140}
    145141
     
    187183       
    188184        if( conn->inpa != -1 )
    189                 gaim_input_remove( conn->inpa );
     185                b_event_remove( conn->inpa );
    190186       
    191187        if( conn->established )
     
    204200}
    205201
    206 GaimInputCondition ssl_getdirection( void *conn )
     202b_input_condition ssl_getdirection( void *conn )
    207203{
    208204        return( gnutls_record_get_direction( ((struct scd*)conn)->session ) ?
  • protocols/ssl_nss.c

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

    r3af70b0 rb72caac  
    5252};
    5353
    54 static void ssl_connected( gpointer data, gint source, GaimInputCondition cond );
    55 
     54static gboolean ssl_connected( gpointer data, gint source, b_input_condition cond );
    5655
    5756
     
    9594}
    9695
    97 static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond );
    98 
    99 static void ssl_connected( gpointer data, gint source, GaimInputCondition cond )
     96static gboolean ssl_handshake( gpointer data, gint source, b_input_condition cond );
     97
     98static gboolean ssl_connected( gpointer data, gint source, b_input_condition cond )
    10099{
    101100        struct scd *conn = data;
     
    104103                return ssl_handshake( data, -1, cond );
    105104       
    106         /* Make it non-blocking at least during the handshake... */
     105        /* We can do at least the handshake with non-blocking I/O */
    107106        sock_make_nonblocking( conn->fd );
    108107        SSL_set_fd( conn->ssl, conn->fd );
     
    111110}       
    112111
    113 static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond )
     112static gboolean ssl_handshake( gpointer data, gint source, b_input_condition cond )
    114113{
    115114        struct scd *conn = data;
    116115        int st;
    117        
    118         if( conn->inpa != -1 )
    119         {
    120                 gaim_input_remove( conn->inpa );
    121                 conn->inpa = -1;
    122         }
    123116       
    124117        if( ( st = SSL_connect( conn->ssl ) ) < 0 )
     
    128121                        goto ssl_connected_failure;
    129122               
    130                 conn->inpa = gaim_input_add( conn->fd, ssl_getdirection( conn ), ssl_handshake, data );
    131                 return;
     123                conn->inpa = b_input_add( conn->fd, ssl_getdirection( conn ), ssl_handshake, data );
     124                return FALSE;
    132125        }
    133126       
     
    135128        sock_make_blocking( conn->fd );         /* For now... */
    136129        conn->func( conn->data, conn, cond );
    137         return;
     130        return FALSE;
    138131       
    139132ssl_connected_failure:
     
    151144        if( source >= 0 ) closesocket( source );
    152145        g_free( conn );
     146       
     147        return FALSE;
    153148}
    154149
     
    204199       
    205200        if( conn->inpa != -1 )
    206                 gaim_input_remove( conn->inpa );
     201                b_event_remove( conn->inpa );
    207202       
    208203        if( conn->established )
     
    221216}
    222217
    223 GaimInputCondition ssl_getdirection( void *conn )
     218b_input_condition ssl_getdirection( void *conn )
    224219{
    225220        return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? GAIM_INPUT_WRITE : GAIM_INPUT_READ );
  • protocols/yahoo/yahoo.c

    r3af70b0 rb72caac  
    443443};
    444444
    445 void byahoo_connect_callback( gpointer data, gint source, GaimInputCondition cond )
     445void byahoo_connect_callback( gpointer data, gint source, b_input_condition cond )
    446446{
    447447        struct byahoo_connect_callback_data *d = data;
     
    465465};
    466466
    467 void byahoo_read_ready_callback( gpointer data, gint source, GaimInputCondition cond )
     467gboolean byahoo_read_ready_callback( gpointer data, gint source, b_input_condition cond )
    468468{
    469469        struct byahoo_read_ready_data *d = data;
    470470       
    471471        if( !byahoo_get_gc_by_id( d->id ) )
    472         {
    473472                /* WTF doesn't libyahoo clean this up? */
    474                 ext_yahoo_remove_handler( d->id, d->tag );
    475                 return;
    476         }
     473                return FALSE;
    477474       
    478475        yahoo_read_ready( d->id, d->fd, d->data );
     476       
     477        return TRUE;
    479478}
    480479
     
    487486};
    488487
    489 void byahoo_write_ready_callback( gpointer data, gint source, GaimInputCondition cond )
     488gboolean byahoo_write_ready_callback( gpointer data, gint source, b_input_condition cond )
    490489{
    491490        struct byahoo_write_ready_data *d = data;
    492491       
    493492        if( !byahoo_get_gc_by_id( d->id ) )
    494         {
    495493                /* WTF doesn't libyahoo clean this up? */
    496                 ext_yahoo_remove_handler( d->id, d->tag );
    497                 return;
    498         }
     494                return FALSE;
    499495       
    500496        yahoo_write_ready( d->id, d->fd, d->data );
     497       
     498        return FALSE;
    501499}
    502500
     
    687685               
    688686                inp->d = d;
    689                 d->tag = inp->h = gaim_input_add( fd, GAIM_INPUT_READ, (GaimInputFunction) byahoo_read_ready_callback, (gpointer) d );
     687                d->tag = inp->h = b_input_add( fd, GAIM_INPUT_READ, (b_event_handler) byahoo_read_ready_callback, (gpointer) d );
    690688        }
    691689        else if( cond == YAHOO_INPUT_WRITE )
     
    698696               
    699697                inp->d = d;
    700                 d->tag = inp->h = gaim_input_add( fd, GAIM_INPUT_WRITE, (GaimInputFunction) byahoo_write_ready_callback, (gpointer) d );
     698                d->tag = inp->h = b_input_add( fd, GAIM_INPUT_WRITE, (b_event_handler) byahoo_write_ready_callback, (gpointer) d );
    701699        }
    702700        else
     
    729727        }
    730728       
    731         gaim_input_remove( tag );
     729        b_event_remove( tag );
    732730}
    733731
     
    738736       
    739737        d = g_new0( struct byahoo_connect_callback_data, 1 );
    740         if( ( fd = proxy_connect( host, port, (GaimInputFunction) byahoo_connect_callback, (gpointer) d ) ) < 0 )
     738        if( ( fd = proxy_connect( host, port, (b_event_handler) byahoo_connect_callback, (gpointer) d ) ) < 0 )
    741739        {
    742740                g_free( d );
  • sock.h

    r3af70b0 rb72caac  
    1818#define sock_make_blocking(fd) fcntl(fd, F_SETFL, 0)
    1919#define sockerr_again() (errno == EINPROGRESS || errno == EINTR)
     20#ifndef EVENTS_LIBEVENT
    2021#define closesocket(a) close(a)
     22#endif
    2123#else
    2224# include <winsock2.h>
  • unix.c

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

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