diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2009-11-23 23:00:54 +0000 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2009-11-23 23:00:54 +0000 | 
| commit | 4e041946706d3fc3aed405152028b02ec2794902 (patch) | |
| tree | ef4a4862f5476c49150cdd25f2ebbb3707ea2246 /protocols/nogaim.c | |
| parent | b3117f2524775ff7c61ead7c3bdb3799064ed97f (diff) | |
| parent | fb51d85751b36098ad4271bc4553ade4dc53f20b (diff) | |
Merging BitlBee 1.2.4+
Diffstat (limited to 'protocols/nogaim.c')
| -rw-r--r-- | protocols/nogaim.c | 65 | 
1 files changed, 52 insertions, 13 deletions
| diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 7e8782ac..c0d4a953 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -32,9 +32,11 @@  */  #define BITLBEE_CORE -#include "nogaim.h"  #include <ctype.h> +#include "nogaim.h" +#include "chat.h" +  static int remove_chat_buddy_silent( struct groupchat *b, const char *handle );  GSList *connections; @@ -521,33 +523,70 @@ void imcb_buddy_nick_hint( struct im_connection *ic, char *handle, char *nick )  	}  } -/* prpl.c */ -struct show_got_added_data +struct imcb_ask_cb_data  {  	struct im_connection *ic;  	char *handle;  }; -void show_got_added_no( void *data ) +static void imcb_ask_auth_cb_no( void *data ) +{ +	struct imcb_ask_cb_data *cbd = data; +	 +	cbd->ic->acc->prpl->auth_deny( cbd->ic, cbd->handle ); +	 +	g_free( cbd->handle ); +	g_free( cbd ); +} + +static void imcb_ask_auth_cb_yes( void *data ) +{ +	struct imcb_ask_cb_data *cbd = data; +	 +	cbd->ic->acc->prpl->auth_allow( cbd->ic, cbd->handle ); +	 +	g_free( cbd->handle ); +	g_free( cbd ); +} + +void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *realname ) +{ +	struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 ); +	char *s, *realname_ = NULL; +	 +	if( realname != NULL ) +		realname_ = g_strdup_printf( " (%s)", realname ); +	 +	s = g_strdup_printf( "The user %s%s wants to add you to his/her buddy list.", +	                     handle, realname_ ?: "" ); +	 +	g_free( realname_ ); +	 +	data->ic = ic; +	data->handle = g_strdup( handle ); +	query_add( ic->irc, ic, s, imcb_ask_auth_cb_yes, imcb_ask_auth_cb_no, data ); +} + + +static void imcb_ask_add_cb_no( void *data )  { -	g_free( ((struct show_got_added_data*)data)->handle ); +	g_free( ((struct imcb_ask_cb_data*)data)->handle );  	g_free( data );  } -void show_got_added_yes( void *data ) +static void imcb_ask_add_cb_yes( void *data )  { -	struct show_got_added_data *sga = data; +	struct imcb_ask_cb_data *cbd = data; -	sga->ic->acc->prpl->add_buddy( sga->ic, sga->handle, NULL ); -	/* imcb_add_buddy( sga->ic, NULL, sga->handle, sga->handle ); */ +	cbd->ic->acc->prpl->add_buddy( cbd->ic, cbd->handle, NULL ); -	return show_got_added_no( data ); +	return imcb_ask_add_cb_no( data );  } -void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname ) +void imcb_ask_add( struct im_connection *ic, const char *handle, const char *realname )  { -	struct show_got_added_data *data = g_new0( struct show_got_added_data, 1 ); +	struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 );  	char *s;  	/* TODO: Make a setting for this! */ @@ -558,7 +597,7 @@ void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname  	data->ic = ic;  	data->handle = g_strdup( handle ); -	query_add( ic->irc, ic, s, show_got_added_yes, show_got_added_no, data ); +	query_add( ic->irc, ic, s, imcb_ask_add_cb_yes, imcb_ask_add_cb_no, data );  } | 
