Changeset fc2ee0f for protocols


Ignore:
Timestamp:
2006-05-13T10:29:53Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
2b7d2d1
Parents:
b642f381
Message:

It works, it works! \o/

Location:
protocols
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • protocols/Makefile

    rb642f381 rfc2ee0f  
    1111# [SH] Program variables
    1212objects = events_libevent.o http_client.o md5.o nogaim.o proxy.o sha.o $(SSL_CLIENT)
     13#objects = events_glib.o http_client.o md5.o nogaim.o proxy.o sha.o $(SSL_CLIENT)
    1314
    1415# [SH] The next two lines should contain the directory name (in $(subdirs))
  • protocols/events.h

    rb642f381 rfc2ee0f  
    4949#define GAIM_ERR_COND   (G_IO_HUP | G_IO_ERR | G_IO_NVAL)
    5050
     51#define event_debug( x... ) printf( x )
     52
    5153G_MODULE_EXPORT void b_main_init();
    5254G_MODULE_EXPORT void b_main_run();
  • protocols/events_glib.c

    rb642f381 rfc2ee0f  
    7373        GaimIOClosure *closure = data;
    7474        b_input_condition gaim_cond = 0;
     75        gboolean st;
    7576
    7677        if (condition & GAIM_READ_COND)
     
    7879        if (condition & GAIM_WRITE_COND)
    7980                gaim_cond |= GAIM_INPUT_WRITE;
     81       
     82        event_debug( "gaim_io_invoke( %d, %d, 0x%x )\n", g_io_channel_unix_get_fd(source), condition, data );
    8083
    81         return closure->function(closure->data, g_io_channel_unix_get_fd(source), gaim_cond);
     84        st = closure->function(closure->data, g_io_channel_unix_get_fd(source), gaim_cond);
     85       
     86        if( !st )
     87                event_debug( "Returned FALSE, cancelling.\n" );
     88       
     89        return st;
    8290}
    8391
    8492static void gaim_io_destroy(gpointer data)
    8593{
     94        event_debug( "gaim_io_destroy( 0x%x )\n", data );
    8695        g_free(data);
    8796}
     
    105114                                              gaim_io_invoke, closure, gaim_io_destroy);
    106115       
     116        event_debug( "b_input_add( %d, %d, 0x%x, 0x%x ) = %d (0x%x)\n", source, condition, function, data, closure->result, closure );
     117       
    107118        g_io_channel_unref(channel);
    108119        return closure->result;
     
    111122gint b_timeout_add(gint timeout, b_event_handler func, gpointer data)
    112123{
    113         return g_timeout_add(timeout, func, data);
     124        gint st = g_timeout_add(timeout, func, data);
     125       
     126        event_debug( "b_timeout_add( %d, %d, %d ) = %d\n", timeout, func, data, st );
     127       
     128        return st;
    114129}
    115130
    116131void b_event_remove(gint tag)
    117132{
     133        event_debug( "g_source_remove( %d )\n", tag );
     134       
    118135        if (tag > 0)
    119136                g_source_remove(tag);
  • protocols/events_libevent.c

    rb642f381 rfc2ee0f  
    7272        struct b_event_data *b_ev = data;
    7373        b_input_condition cond = 0;
     74        int id;
    7475       
    7576        if( fd >= 0 )
     
    8384        event_debug( "b_event_passthrough( %d, %d, 0x%x ) (%d)\n", fd, event, (int) data, b_ev->id );
    8485       
     86        /* Since the called function might cancel this handler already
     87           (which free()s b_ev, we have to remember the ID here. */
     88        id = b_ev->id;
     89       
    8590        if( !b_ev->function( b_ev->data, fd, cond ) )
    8691        {
    8792                event_debug( "Handler returned FALSE: " );
    88                 b_event_remove( b_ev->id );
     93                b_event_remove( id );
    8994        }
    9095}
     
    151156        else
    152157        {
    153                 event_debug( "Invalid?\n" );
     158                event_debug( "Double remove?\n" );
    154159        }
    155160}
Note: See TracChangeset for help on using the changeset viewer.