diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-06-06 00:21:02 +0100 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-06-06 00:21:02 +0100 | 
| commit | b308cf9bafbdf76da73a57607b65c4763aa3057b (patch) | |
| tree | c686906b479a0edd52b18a213e1d420f7343855d /lib/events_libevent.c | |
| parent | 3ab1d317831a6c1830bb648a1a8d63a41c92f651 (diff) | |
| parent | e774815bc621af90bb64ca314b84367659c5a005 (diff) | |
Merging libpurple branch into killerbee. It's fairly usable already, and
Debian packaging is now properly separated. This also picks up a load of
stuff from mainline it seems.
Diffstat (limited to 'lib/events_libevent.c')
| -rw-r--r-- | lib/events_libevent.c | 16 | 
1 files changed, 9 insertions, 7 deletions
| diff --git a/lib/events_libevent.c b/lib/events_libevent.c index cf616576..43d770ea 100644 --- a/lib/events_libevent.c +++ b/lib/events_libevent.c @@ -59,6 +59,7 @@ struct b_event_data  	gint timeout;  	b_event_handler function;  	void *data; +	guint flags;  };  void b_main_init() @@ -125,9 +126,9 @@ static void b_event_passthrough( int fd, short event, void *data )  	if( fd >= 0 )  	{  		if( event & EV_READ ) -			cond |= GAIM_INPUT_READ; +			cond |= B_EV_IO_READ;  		if( event & EV_WRITE ) -			cond |= GAIM_INPUT_WRITE; +			cond |= B_EV_IO_WRITE;  	}  	event_debug( "b_event_passthrough( %d, %d, 0x%x ) (%d)\n", fd, event, (int) data, b_ev->id ); @@ -149,7 +150,7 @@ static void b_event_passthrough( int fd, short event, void *data )  		/* This event was killed already, don't touch it! */  		return;  	} -	else if( !st ) +	else if( !st && !( b_ev->flags & B_EV_FLAG_FORCE_REPEAT ) )  	{  		event_debug( "Handler returned FALSE: " );  		b_event_remove( id_cur ); @@ -173,8 +174,8 @@ gint b_input_add( gint fd, b_input_condition condition, b_event_handler function  	event_debug( "b_input_add( %d, %d, 0x%x, 0x%x ) ", fd, condition, function, data ); -	if( ( condition & GAIM_INPUT_READ  && ( b_ev = g_hash_table_lookup( read_hash,  &fd ) ) ) || -	    ( condition & GAIM_INPUT_WRITE && ( b_ev = g_hash_table_lookup( write_hash, &fd ) ) ) ) +	if( ( condition & B_EV_IO_READ  && ( b_ev = g_hash_table_lookup( read_hash,  &fd ) ) ) || +	    ( condition & B_EV_IO_WRITE && ( b_ev = g_hash_table_lookup( write_hash, &fd ) ) ) )  	{  		/* We'll stick with this libevent entry, but give it a new BitlBee id. */  		g_hash_table_remove( id_hash, &b_ev->id ); @@ -197,9 +198,9 @@ gint b_input_add( gint fd, b_input_condition condition, b_event_handler function  		b_ev->data = data;  		out_cond = EV_PERSIST; -		if( condition & GAIM_INPUT_READ ) +		if( condition & B_EV_IO_READ )  			out_cond |= EV_READ; -		if( condition & GAIM_INPUT_WRITE ) +		if( condition & B_EV_IO_WRITE )  			out_cond |= EV_WRITE;  		event_set( &b_ev->evinfo, fd, out_cond, b_event_passthrough, b_ev ); @@ -211,6 +212,7 @@ gint b_input_add( gint fd, b_input_condition condition, b_event_handler function  			g_hash_table_insert( write_hash, &b_ev->evinfo.ev_fd, b_ev );  	} +	b_ev->flags = condition;  	g_hash_table_insert( id_hash, &b_ev->id, b_ev );  	return b_ev->id;  } | 
