diff options
| -rw-r--r-- | .bzrignore | 1 | ||||
| -rw-r--r-- | doc/user-guide/commands.xml | 9 | ||||
| -rw-r--r-- | help.c | 17 | ||||
| -rw-r--r-- | ipc.c | 2 | ||||
| -rw-r--r-- | irc.c | 7 | ||||
| -rw-r--r-- | irc.h | 2 | ||||
| -rw-r--r-- | irc_commands.c | 6 | ||||
| -rw-r--r-- | protocols/jabber/jabber.c | 5 | ||||
| -rw-r--r-- | protocols/msn/msn.h | 5 | ||||
| -rw-r--r-- | protocols/msn/msn_util.c | 11 | ||||
| -rw-r--r-- | protocols/msn/ns.c | 51 | ||||
| -rw-r--r-- | protocols/msn/sb.c | 8 | ||||
| -rw-r--r-- | protocols/nogaim.c | 42 | ||||
| -rw-r--r-- | protocols/oscar/oscar.c | 13 | ||||
| -rw-r--r-- | protocols/ssl_openssl.c | 86 | ||||
| -rw-r--r-- | query.c | 12 | ||||
| -rw-r--r-- | root_commands.c | 82 | ||||
| -rw-r--r-- | user.h | 1 | 
18 files changed, 239 insertions, 121 deletions
| @@ -10,3 +10,4 @@ tags  decode  encode  bitlbee.pc +.gdb_history diff --git a/doc/user-guide/commands.xml b/doc/user-guide/commands.xml index b04a6b0a..fd803801 100644 --- a/doc/user-guide/commands.xml +++ b/doc/user-guide/commands.xml @@ -196,11 +196,16 @@  		<short-description>Block someone</short-description>  		<syntax>block <nick></syntax>  		<syntax>block <connection> <handle></syntax> +		<syntax>block <connection></syntax>  		<description>  			<para>  				Puts the specified user on your ignore list. Either specify the user's nick when you have him/her in your contact list or a connection number and a user handle.  			</para> +			 +			<para> +				When called with only a connection specification as an argument, the command displays the current block list for that connection. +			</para>  		</description>  	</bitlbee-command> @@ -213,6 +218,10 @@  			<para>  				Reverse of block. Unignores the specified user or user handle on specified connection.  			</para> +			 +			<para> +				When called with only a connection specification as an argument, the command displays the current allow list for that connection. +			</para>  		</description>  	</bitlbee-command> @@ -115,22 +115,21 @@ char *help_get( help_t **help, char *string )  		if( g_strcasecmp( h->string, string ) == 0 ) break;  		h = h->next;  	} -	if( h ) +	if( h && h->length > 0 )  	{  		char *s = g_new( char, h->length + 1 );  		if( fstat( h->fd, stat ) != 0 )  		{  			g_free( h ); -			*help=NULL; -			return( NULL ); +			*help = NULL; +			return NULL;  		}  		mtime = stat->st_mtime; -		if( mtime > h->mtime ) { -			return( NULL ); -			return( g_strdup( "Help file changed during this session. Please restart to get help back." ) ); -		} +		if( mtime > h->mtime ) +			return NULL; +		  		s[h->length] = 0;  		if( h->fd >= 0 )  		{ @@ -141,8 +140,8 @@ char *help_get( help_t **help, char *string )  		{  			strncpy( s, h->offset.mem_offset, h->length );  		} -		return( s ); +		return s;  	} -	return( NULL ); +	return NULL;  } @@ -83,8 +83,6 @@ void ipc_master_cmd_rehash( irc_t *data, char **cmd )  void ipc_master_cmd_restart( irc_t *data, char **cmd )  { -	struct bitlbee_child *child = (void*) data; -	  	if( global.conf->runmode != RUNMODE_FORKDAEMON )  	{  		/* Tell child that this is unsupported. */ @@ -231,9 +231,12 @@ void irc_free(irc_t * irc)  	g_io_channel_unref( irc->io_channel );  	irc_connection_list = g_slist_remove( irc_connection_list, irc ); -	for (account = irc->accounts; account; account = account->next) +	for (account = irc->accounts; account; account = account->next) {  		if (account->gc) -			signoff(account->gc); +			account_offline(account->gc); +		else if (account->reconnect) +			g_source_remove(account->reconnect); +	}  	g_free(irc->sendbuffer);  	g_free(irc->readbuffer); @@ -32,7 +32,7 @@  #define IRC_LOGIN_TIMEOUT 60  #define IRC_PING_STRING "PinglBee" -#define UMODES "iasw" +#define UMODES "abisw"  #define UMODES_PRIV "Ro"  #define CMODES "nt"  #define CMODE "t" diff --git a/irc_commands.c b/irc_commands.c index f2c7a645..01b01dfb 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -510,6 +510,11 @@ static void irc_cmd_pong( irc_t *irc, char **cmd )  	irc->pinging = 0;  } +static void irc_cmd_version( irc_t *irc, char **cmd ) +{ +	irc_reply( irc, 351, "bitlbee-%s. %s :%s/%s ", BITLBEE_VERSION, irc->myhost, ARCH, CPU ); +} +  static void irc_cmd_completions( irc_t *irc, char **cmd )  {  	user_t *u = user_find( irc, irc->mynick ); @@ -567,6 +572,7 @@ static const command_t irc_commands[] = {  	{ "ns",          1, irc_cmd_nickserv,    IRC_CMD_LOGGED_IN },  	{ "motd",        0, irc_cmd_motd,        IRC_CMD_LOGGED_IN },  	{ "pong",        0, irc_cmd_pong,        IRC_CMD_LOGGED_IN }, +	{ "version",     0, irc_cmd_version,     IRC_CMD_LOGGED_IN },  	{ "completions", 0, irc_cmd_completions, IRC_CMD_LOGGED_IN },  	{ "die",         0, NULL,                IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER },  	{ "wallops",     1, NULL,                IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER }, diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index ba652b8a..224762ce 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -1231,9 +1231,7 @@ static void jabber_handleroster(gjconn gjc, xmlnode querynode)  		x = xmlnode_get_nextsibling(x);  	} -	x = jutil_presnew(0, NULL, "Online"); -	gjab_send(gjc, x); -	xmlnode_free(x); +	account_online(GJ_GC(gjc));  }  static void jabber_handleauthresp(gjconn gjc, jpacket p) @@ -1249,7 +1247,6 @@ static void jabber_handleauthresp(gjconn gjc, jpacket p)  			gjab_auth(gjc);  		} else {  			gjab_reqroster(gjc); -			account_online(GJ_GC(gjc));  			((struct jabber_data *)GJ_GC(gjc)->proto_data)->did_import = TRUE;  		} diff --git a/protocols/msn/msn.h b/protocols/msn/msn.h index 9727c537..0cd174f2 100644 --- a/protocols/msn/msn.h +++ b/protocols/msn/msn.h @@ -65,8 +65,11 @@ struct msn_data  	GSList *msgq;  	GSList *switchboards; -	int buddycount;  	const struct msn_away_state *away_state; +	 +	int buddycount; +	int groupcount; +	char **grouplist;  };  struct msn_switchboard diff --git a/protocols/msn/msn_util.c b/protocols/msn/msn_util.c index e5f0b2c9..5cda9f1c 100644 --- a/protocols/msn/msn_util.c +++ b/protocols/msn/msn_util.c @@ -45,19 +45,8 @@ int msn_write( struct gaim_connection *gc, char *s, int len )  int msn_logged_in( struct gaim_connection *gc )  { -	struct msn_data *md = gc->proto_data; -	char buf[1024]; -	  	account_online( gc ); -	/* account_online() sets an away state if there is any, so only -	   execute this code if we're not away. */ -	if( md->away_state == msn_away_state_list ) -	{ -		g_snprintf( buf, sizeof( buf ), "CHG %d %s %d\r\n", ++md->trId, md->away_state->code, 0 ); -		return( msn_write( gc, buf, strlen( buf ) ) ); -	} -	  	return( 0 );  } diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c index 4ced58a0..90d525ef 100644 --- a/protocols/msn/ns.c +++ b/protocols/msn/ns.c @@ -256,6 +256,9 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  		if( num_parts == 5 )  		{  			md->buddycount = atoi( cmd[3] ); +			md->groupcount = atoi( cmd[4] ); +			if( md->groupcount > 0 ) +				md->grouplist = g_new0( char *, md->groupcount );  			if( !*cmd[3] || md->buddycount == 0 )  				msn_logged_in( gc ); @@ -268,18 +271,6 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  			msn_logged_in( gc );  		}  	} -	else if( strcmp( cmd[0], "GTC" ) == 0 ) -	{ -	} -	else if( strcmp( cmd[0], "BLP" ) == 0 ) -	{ -	} -	else if( strcmp( cmd[0], "PRP" ) == 0 ) -	{ -	} -	else if( strcmp( cmd[0], "LSG" ) == 0 ) -	{ -	}  	else if( strcmp( cmd[0], "LST" ) == 0 )  	{  		int list; @@ -296,7 +287,13 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  		if( list & 1 ) /* FL */  		{ -			add_buddy( gc, NULL, cmd[1], cmd[2] ); +			char *group = NULL; +			int num; +			 +			if( cmd[4] != NULL && sscanf( cmd[4], "%d", &num ) == 1 ) +				group = md->grouplist[num]; +			 +			add_buddy( gc, group, cmd[1], cmd[2] );  		}  		if( list & 2 ) /* AL */  		{ @@ -326,11 +323,22 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  			}  		}  	} -	else if( strcmp( cmd[0], "BPR" ) == 0 ) -	{ -	} -	else if( strcmp( cmd[0], "CHG" ) == 0 ) +	else if( strcmp( cmd[0], "LSG" ) == 0 )  	{ +		int num; +		 +		if( num_parts != 4 ) +		{ +			hide_login_progress_error( gc, "Syntax error" ); +			signoff( gc ); +			return( 0 ); +		} +		 +		http_decode( cmd[2] ); +		num = atoi( cmd[1] ); +		 +		if( num < md->groupcount ) +			md->grouplist[num] = g_strdup( cmd[2] );  	}  	else if( strcmp( cmd[0], "CHL" ) == 0 )  	{ @@ -356,12 +364,6 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  		return( msn_write( gc, buf, strlen( buf ) ) );  	} -	else if( strcmp( cmd[0], "QRY" ) == 0 ) -	{ -	} -	else if( strcmp( cmd[0], "QNG" ) == 0 ) -	{ -	}  	else if( strcmp( cmd[0], "ILN" ) == 0 )  	{  		const struct msn_away_state *st; @@ -478,9 +480,6 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  			msn_buddy_ask( gc, cmd[4], cmd[5] );  		}  	} -	else if( strcmp( cmd[0], "REM" ) == 0 ) -	{ -	}  	else if( strcmp( cmd[0], "OUT" ) == 0 )  	{  		if( cmd[1] && strcmp( cmd[1], "OTH" ) == 0 ) diff --git a/protocols/msn/sb.c b/protocols/msn/sb.c index deaceba1..234be1d6 100644 --- a/protocols/msn/sb.c +++ b/protocols/msn/sb.c @@ -201,9 +201,6 @@ void msn_sb_destroy( struct msn_switchboard *sb )  	debug( "Destroying switchboard: %s", sb->who ? sb->who : sb->key ? sb->key : "" ); -	if( sb->key ) g_free( sb->key ); -	if( sb->who ) g_free( sb->who ); -	  	if( sb->msgq )  	{  		struct msn_message *m; @@ -221,9 +218,12 @@ void msn_sb_destroy( struct msn_switchboard *sb )  		serv_got_crap( gc, "Warning: Closing down MSN switchboard connection with "  		                   "unsent message to %s, you'll have to resend it.", -		                   m->who ? m->who : "(unknown)" ); +		                   sb->who ? sb->who : "(unknown)" );  	} +	if( sb->key ) g_free( sb->key ); +	if( sb->who ) g_free( sb->who ); +	  	if( sb->chat )  	{  		serv_got_chat_left( gc, sb->chat->id ); diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 29ae860a..28f76fff 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -13,7 +13,7 @@   * from scratch for BitlBee and doesn't contain any code from Gaim anymore   * (except for the function names).   * - * Copyright 2002-2004 Wilmer van der Gaast <lintux@lintux.cx> + * Copyright 2002-2006 Wilmer van der Gaast <wilmer@gaast.net> and others   */  /* @@ -38,7 +38,7 @@  #include <ctype.h>  #include <iconv.h> -static char *proto_away_alias[7][5] = +static char *proto_away_alias[8][5] =  {  	{ "Away from computer", "Away", "Extended away", NULL },  	{ "NA", "N/A", "Not available", NULL }, @@ -46,6 +46,7 @@ static char *proto_away_alias[7][5] =  	{ "Be right back", "BRB", NULL },  	{ "On the phone", "Phone", "On phone", NULL },  	{ "Out to lunch", "Lunch", "Food", NULL }, +	{ "Invisible", "Hidden" },  	{ NULL }  };  static char *proto_away_alias_find( GList *gcm, char *away ); @@ -304,7 +305,7 @@ void hide_login_progress_error( struct gaim_connection *gc, char *msg )  void serv_got_crap( struct gaim_connection *gc, char *format, ... )  {  	va_list params; -	char text[1024], buf[1024], acc_id[33]; +	char text[1024], buf[1024], *acc_id;  	char *msg;  	account_t *a; @@ -329,11 +330,13 @@ void serv_got_crap( struct gaim_connection *gc, char *format, ... )  	/* If we found one, add the screenname to the acc_id. */  	if( a ) -		g_snprintf( acc_id, 32, "%s(%s)", gc->prpl->name, gc->username ); +		acc_id = g_strdup_printf( "%s(%s)", gc->prpl->name, gc->username );  	else -		g_snprintf( acc_id, 32, "%s", gc->prpl->name ); +		acc_id = g_strdup( gc->prpl->name );  	irc_usermsg( gc->irc, "%s - %s", acc_id, msg ); +	 +	g_free( acc_id );  }  static gboolean send_keepalive( gpointer d ) @@ -351,7 +354,7 @@ void account_online( struct gaim_connection *gc )  	user_t *u;  	/* MSN servers sometimes redirect you to a different server and do -	   the whole login sequence again, so subsequent calls to this +	   the whole login sequence again, so these "late" calls to this  	   function should be handled correctly. (IOW, ignored) */  	if( gc->flags & OPT_LOGGED_IN )  		return; @@ -363,9 +366,11 @@ void account_online( struct gaim_connection *gc )  	gc->keepalive = g_timeout_add( 60000, send_keepalive, gc );  	gc->flags |= OPT_LOGGED_IN; -	if( u && u->away ) proto_away( gc, u->away ); +	/* Also necessary when we're not away, at least for some of the +	   protocols. */ +	proto_away( gc, u->away ); - 	if( !strcmp(gc->prpl->name, "icq") ) + 	if( strcmp( gc->prpl->name, "ICQ" ) == 0 )  	{  		for( u = gc->irc->users; u; u = u->next )  			if( u->gc == gc ) @@ -469,16 +474,6 @@ void do_ask_dialog( struct gaim_connection *gc, char *msg, void *data, void *doi  /* list.c */ -int bud_list_cache_exists( struct gaim_connection *gc ) -{ -	return( 0 ); -} - -void do_import( struct gaim_connection *gc, void *null ) -{ -	return; -} -  void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *realname )  {  	user_t *u; @@ -530,6 +525,7 @@ void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *rea  	u->gc = gc;  	u->handle = g_strdup( handle ); +	if( group ) u->group = g_strdup( group );  	u->send_handler = buddy_send_handler;  	u->last_typing_notice = 0;  } @@ -553,11 +549,6 @@ struct buddy *find_buddy( struct gaim_connection *gc, char *handle )  	return( b );  } -void do_export( struct gaim_connection *gc ) -{ -	return; -} -  void signoff_blocked( struct gaim_connection *gc )  {  	return; /* Make all blocked users look invisible (TODO?) */ @@ -883,11 +874,6 @@ struct conversation *serv_got_joined_chat( struct gaim_connection *gc, int id, c  	return( c );  } -void serv_finish_login( struct gaim_connection *gc ) -{ -	return; -} -  /* buddy_chat.c */ diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 4e552bce..97384afb 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -355,7 +355,9 @@ static void oscar_login(struct aim_user *user) {  	if (isdigit(*user->username)) {  		odata->icq = TRUE; -		/* this is odd but it's necessary for a proper do_import and do_export */ +		/* This is odd but it's necessary for a proper do_import and do_export. +		   We don't do those anymore, but let's stick with it, just in case +		   it accidentally fixes something else too... */  		gc->password[8] = 0;  	} else {  		gc->flags |= OPT_CONN_HTML; @@ -1147,7 +1149,7 @@ static void gaim_icq_authask(struct gaim_connection *gc, guint32 uin, char *msg)  	if (strlen(msg) > 6)  		reason = msg + 6; -	dialog_msg = g_strdup_printf("The user %u wants to add you to their buddy list for the following reason:\n\n%s", uin, reason ? reason : "No reason given."); +	dialog_msg = g_strdup_printf("The user %u wants to add you to their buddy list for the following reason: %s", uin, reason ? reason : "No reason given.");  	data->gc = gc;  	data->uin = uin;  	do_ask_dialog(gc, dialog_msg, data, gaim_icq_authgrant, gaim_icq_authdeny); @@ -1736,11 +1738,6 @@ static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) {  	odata->rights.maxpermits = (guint)maxpermits;  	odata->rights.maxdenies = (guint)maxdenies; -//	serv_finish_login(gc); - -	if (bud_list_cache_exists(gc)) -		do_import(gc, NULL); -  	aim_clientready(sess, fr->conn);  	aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_CHATNAV); @@ -2095,8 +2092,6 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) {  		} /* End of switch on curitem->type */  	} /* End of for loop */ -	if (tmp) -		do_export(gc);  	aim_ssi_enable(sess, fr->conn);  	/* Request offline messages, now that the buddy list is complete. */ diff --git a/protocols/ssl_openssl.c b/protocols/ssl_openssl.c index e62f95b9..b79088cc 100644 --- a/protocols/ssl_openssl.c +++ b/protocols/ssl_openssl.c @@ -4,7 +4,7 @@    * Copyright 2002-2004 Wilmer van der Gaast and others                *    \********************************************************************/ -/* SSL module - OpenTLS version                                          */ +/* SSL module - OpenSSL version                                         */  /*    This program is free software; you can redistribute it and/or modify @@ -40,11 +40,13 @@ static gboolean initialized = FALSE;  struct scd  { -	SslInputFunction func; +	ssl_input_function func;  	gpointer data;  	int fd;  	gboolean established; +	int inpa; +	int lasterr;		/* Necessary for SSL_get_error */  	SSL *ssl;  	SSL_CTX *ssl_ctx;  }; @@ -53,7 +55,7 @@ static void ssl_connected( gpointer data, gint source, GaimInputCondition cond ) -void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data ) +void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )  {  	struct scd *conn = g_new0( struct scd, 1 );  	SSL_METHOD *meth; @@ -92,19 +94,45 @@ void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data )  	return( conn );  } +static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond ); +  static void ssl_connected( gpointer data, gint source, GaimInputCondition cond )  {  	struct scd *conn = data;  	if( source == -1 ) -		goto ssl_connected_failure; +		return ssl_handshake( data, -1, cond ); +	/* Make it non-blocking at least during the handshake... */ +	sock_make_nonblocking( conn->fd );  	SSL_set_fd( conn->ssl, conn->fd ); -	if( SSL_connect( conn->ssl ) < 0 ) -		goto ssl_connected_failure; +	return ssl_handshake( data, source, cond ); +}	 + +static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond ) +{ +	struct scd *conn = data; +	int st; +	 +	if( conn->inpa != -1 ) +	{ +		gaim_input_remove( conn->inpa ); +		conn->inpa = -1; +	} +	 +	if( ( st = SSL_connect( conn->ssl ) ) < 0 ) +	{ +		conn->lasterr = SSL_get_error( conn->ssl, st ); +		if( conn->lasterr != SSL_ERROR_WANT_READ && conn->lasterr != SSL_ERROR_WANT_WRITE ) +			goto ssl_connected_failure; +		 +		conn->inpa = gaim_input_add( conn->fd, ssl_getdirection( conn ), ssl_handshake, data ); +		return; +	}  	conn->established = TRUE; +	sock_make_blocking( conn->fd );		/* For now... */  	conn->func( conn->data, conn, cond );  	return; @@ -126,24 +154,57 @@ ssl_connected_failure:  int ssl_read( void *conn, char *buf, int len )  { +	int st; +	  	if( !((struct scd*)conn)->established ) -		return( 0 ); +	{ +		ssl_errno = SSL_NOHANDSHAKE; +		return -1; +	} +	 +	st = SSL_read( ((struct scd*)conn)->ssl, buf, len ); -	return( SSL_read( ((struct scd*)conn)->ssl, buf, len ) ); +	ssl_errno = SSL_OK; +	if( st <= 0 ) +	{ +		((struct scd*)conn)->lasterr = SSL_get_error( ((struct scd*)conn)->ssl, st ); +		if( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_READ || ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ) +			ssl_errno = SSL_AGAIN; +	} +	 +	return st;  }  int ssl_write( void *conn, const char *buf, int len )  { +	int st; +	  	if( !((struct scd*)conn)->established ) -		return( 0 ); +	{ +		ssl_errno = SSL_NOHANDSHAKE; +		return -1; +	} +	 +	st = SSL_write( ((struct scd*)conn)->ssl, buf, len ); -	return( SSL_write( ((struct scd*)conn)->ssl, buf, len ) ); +	ssl_errno = SSL_OK; +	if( st <= 0 ) +	{ +		((struct scd*)conn)->lasterr = SSL_get_error( ((struct scd*)conn)->ssl, st ); +		if( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_READ || ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ) +			ssl_errno = SSL_AGAIN; +	} +	 +	return st;  }  void ssl_disconnect( void *conn_ )  {  	struct scd *conn = conn_; +	if( conn->inpa != -1 ) +		gaim_input_remove( conn->inpa ); +	  	if( conn->established )  		SSL_shutdown( conn->ssl ); @@ -158,3 +219,8 @@ int ssl_getfd( void *conn )  {  	return( ((struct scd*)conn)->fd );  } + +GaimInputCondition ssl_getdirection( void *conn ) +{ +	return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? GAIM_INPUT_WRITE : GAIM_INPUT_READ ); +} @@ -39,6 +39,17 @@ query_t *query_add( irc_t *irc, struct gaim_connection *gc, char *question, void  	q->no = no;  	q->data = data; +	if( strchr( irc->umode, 'b' ) != NULL ) +	{ +		char *s; +		 +		/* At least for the machine-parseable version, get rid of +		   newlines to make "parsing" easier. */ +		for( s = q->question; *s; s ++ ) +			if( *s == '\r' || *s == '\n' ) +				*s = ' '; +	} +	  	if( irc->queries )  	{  		query_t *l = irc->queries; @@ -126,7 +137,6 @@ void query_answer( irc_t *irc, query_t *q, int ans )  		q = query_default( irc );  		disp = 1;  	} -	//Using irc_usermsg instead of serv_got_crap because \x02A is a char too, so a SPACE is needed.	  	if( ans )  	{  		q->yes( NULL, q->data ); diff --git a/root_commands.c b/root_commands.c index f69442d3..36eec8c3 100644 --- a/root_commands.c +++ b/root_commands.c @@ -483,7 +483,27 @@ static void cmd_block( irc_t *irc, char **cmd )  	struct gaim_connection *gc;  	account_t *a; -	if( !cmd[2] ) +	if( !cmd[2] && ( a = account_get( irc, cmd[1] ) ) && a->gc ) +	{ +		char *format; +		GSList *l; +		 +		if( strchr( irc->umode, 'b' ) != NULL ) +			format = "%s\t%s"; +		else +			format = "%-32.32  %-16.16s"; +		 +		irc_usermsg( irc, format, "Handle", "Nickname" ); +		for( l = a->gc->deny; l; l = l->next ) +		{ +			user_t *u = user_findhandle( a->gc, l->data ); +			irc_usermsg( irc, format, l->data, u ? u->nick : "(none)" ); +		} +		irc_usermsg( irc, "End of list." ); +		 +		return; +	} +	else if( !cmd[2] )  	{  		user_t *u = user_find( irc, cmd[1] );  		if( !u || !u->gc ) @@ -522,7 +542,27 @@ static void cmd_allow( irc_t *irc, char **cmd )  	struct gaim_connection *gc;  	account_t *a; -	if( !cmd[2] ) +	if( !cmd[2] && ( a = account_get( irc, cmd[1] ) ) && a->gc ) +	{ +		char *format; +		GSList *l; +		 +		if( strchr( irc->umode, 'b' ) != NULL ) +			format = "%s\t%s"; +		else +			format = "%-32.32  %-16.16s"; +		 +		irc_usermsg( irc, format, "Handle", "Nickname" ); +		for( l = a->gc->deny; l; l = l->next ) +		{ +			user_t *u = user_findhandle( a->gc, l->data ); +			irc_usermsg( irc, format, l->data, u ? u->nick : "(none)" ); +		} +		irc_usermsg( irc, "End of list." ); +		 +		return; +	} +	else if( !cmd[2] )  	{  		user_t *u = user_find( irc, cmd[1] );  		if( !u || !u->gc ) @@ -634,7 +674,8 @@ static void cmd_blist( irc_t *irc, char **cmd )  {  	int online = 0, away = 0, offline = 0;  	user_t *u; -	char s[64]; +	char s[256]; +	char *format;  	int n_online = 0, n_away = 0, n_offline = 0;  	if( cmd[1] && g_strcasecmp( cmd[1], "all" ) == 0 ) @@ -648,26 +689,41 @@ static void cmd_blist( irc_t *irc, char **cmd )  	else  		online =  away = 1; -	irc_usermsg( irc, "%-16.16s  %-40.40s  %s", "Nick", "User/Host/Network", "Status" ); +	if( strchr( irc->umode, 'b' ) != NULL ) +		format = "%s\t%s\t%s"; +	else +		format = "%-16.16s  %-40.40s  %s"; +	 +	irc_usermsg( irc, format, "Nick", "User/Host/Network", "Status" ); -	if( online == 1 ) for( u = irc->users; u; u = u->next ) if( u->gc && u->online && !u->away ) +	for( u = irc->users; u; u = u->next ) if( u->gc && u->online && !u->away )  	{ -		g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name ); -		irc_usermsg( irc, "%-16.16s  %-40.40s  %s", u->nick, s, "Online" ); +		if( online == 1 ) +		{ +			g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name ); +			irc_usermsg( irc, format, u->nick, s, "Online" ); +		} +		  		n_online ++;  	} -	if( away == 1 ) for( u = irc->users; u; u = u->next ) if( u->gc && u->online && u->away ) +	for( u = irc->users; u; u = u->next ) if( u->gc && u->online && u->away )  	{ -		g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name ); -		irc_usermsg( irc, "%-16.16s  %-40.40s  %s", u->nick, s, u->away ); +		if( away == 1 ) +		{ +			g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name ); +			irc_usermsg( irc, format, u->nick, s, u->away ); +		}  		n_away ++;  	} -	if( offline == 1 ) for( u = irc->users; u; u = u->next ) if( u->gc && !u->online ) +	for( u = irc->users; u; u = u->next ) if( u->gc && !u->online )  	{ -		g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name ); -		irc_usermsg( irc, "%-16.16s  %-40.40s  %s", u->nick, s, "Offline" ); +		if( offline == 1 ) +		{ +			g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name ); +			irc_usermsg( irc, format, u->nick, s, "Offline" ); +		}  		n_offline ++;  	} @@ -36,6 +36,7 @@ typedef struct __USER  	char online;  	char *handle; +	char *group;  	struct gaim_connection *gc;   	char *sendbuf; | 
