diff options
Diffstat (limited to 'root_commands.c')
| -rw-r--r-- | root_commands.c | 58 | 
1 files changed, 55 insertions, 3 deletions
| diff --git a/root_commands.c b/root_commands.c index 2cd1a617..280c93a2 100644 --- a/root_commands.c +++ b/root_commands.c @@ -99,6 +99,7 @@ static void cmd_help( irc_t *irc, char **cmd )  }  static void cmd_account( irc_t *irc, char **cmd ); +static void bitlbee_whatsnew( irc_t *irc );  static void cmd_identify( irc_t *irc, char **cmd )  { @@ -155,6 +156,8 @@ static void cmd_identify( irc_t *irc, char **cmd )  		irc->status |= USTATUS_IDENTIFIED;  		irc_umode_set( irc, "+R", 1 ); +		bitlbee_whatsnew( irc ); +		  		/* The following code is a bit hairy now. With takeover  		   support, we shouldn't immediately auto_connect in case  		   we're going to offer taking over an existing session. @@ -266,6 +269,13 @@ static void cmd_showset( irc_t *irc, set_t **head, char *key )  	if( ( val = set_getstr( head, key ) ) )  		irc_usermsg( irc, "%s = `%s'", key, val ); +	else if( !set_find( head, key ) ) +	{ +		irc_usermsg( irc, "Setting `%s' does not exist.", key ); +		if( *head == irc->b->set ) +			irc_usermsg( irc, "It might be an account or channel setting. " +			             "See \x02help account set\x02 and \x02help channel set\x02." ); +	}  	else  		irc_usermsg( irc, "%s is empty", key );  } @@ -303,7 +313,8 @@ static int cmd_set_real( irc_t *irc, char **cmd, set_t **head, cmd_set_checkflag  		else  			st = set_setstr( head, set_name, value ); -		if( set_getstr( head, set_name ) == NULL ) +		if( set_getstr( head, set_name ) == NULL && +		    set_find( head, set_name ) )  		{  			/* This happens when changing the passwd, for example.  			   Showing these msgs instead gives slightly clearer @@ -327,7 +338,8 @@ static int cmd_set_real( irc_t *irc, char **cmd, set_t **head, cmd_set_checkflag  		set_t *s = *head;  		while( s )  		{ -			cmd_showset( irc, &s, s->key ); +			if( !( s->flags & SET_HIDDEN ) ) +				cmd_showset( irc, &s, s->key );  			s = s->next;  		}  	} @@ -1007,7 +1019,8 @@ static void cmd_blist( irc_t *irc, char **cmd )  	irc_usermsg( irc, format, "Nick", "Handle/Account", "Status" ); -	if( strcmp( set_getstr( &irc->root->last_channel->set, "type" ), "control" ) != 0 ) +	if( irc->root->last_channel && +	    strcmp( set_getstr( &irc->root->last_channel->set, "type" ), "control" ) != 0 )  		irc->root->last_channel = NULL;  	for( l = irc->users; l; l = l->next ) @@ -1270,6 +1283,45 @@ static void cmd_transfer( irc_t *irc, char **cmd )  	}  } +/* Maybe this should be a stand-alone command as well? */ +static void bitlbee_whatsnew( irc_t *irc ) +{ +	int last = set_getint( &irc->b->set, "last_version" ); +	GString *msg = g_string_new( "" ); +	char s[16]; +	 +	if( last >= BITLBEE_VERSION_CODE ) +		return; +	 +	if( last < 0x010206 ) /* 1.2.6 */ +	{ +		g_string_append( msg, +			"Twitter support. See \x02help account add twitter\x02.\n" ); +	} +	if( last < 0x010300 ) /* 1.3dev */ +	{ +		g_string_append( msg, +			"Support for multiple configurable control channels, " +			"each with a subset of your contact list. See " +			"\x02help channels\x02 for more information.\n" +			"File transfer support for some protocols (more if " +			"you use libpurple). Just /DCC SEND stuff. Incoming " +			"files also become DCC transfers.\n" +			"Many more things, briefly described in " +			"\x02help news1.3\x02.\n" ); +	} +	 +	if( msg->len > 0 ) +		irc_usermsg( irc, "%s: This seems to be your first time using this " +		                  "this version of BitlBee. Here's a list of new " +		                  "features you may like to know about:\n\n%s\n", +		                  irc->user->nick, msg->str ); +	 +	g_string_free( msg, TRUE ); +	g_snprintf( s, sizeof( s ), "%d", BITLBEE_VERSION_CODE ); +	set_setstr( &irc->b->set, "last_version", s ); +} +  /* IMPORTANT: Keep this list sorted! The short command logic needs that. */  const command_t commands[] = {  	{ "account",        1, cmd_account,        0 }, | 
