From acd7959038aa74be7e4c05a206ba2882b15fd16b Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 19 Aug 2010 13:21:22 +0100 Subject: Forgot one NULL pointer check in the channel sensitivity code for the blist command. --- root_commands.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'root_commands.c') diff --git a/root_commands.c b/root_commands.c index 2cd1a617..5b761bb6 100644 --- a/root_commands.c +++ b/root_commands.c @@ -1007,7 +1007,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 ) -- cgit v1.2.3 From 5613af716212defcf5ee51f8dc13525f54323382 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 21 Aug 2010 18:59:03 +0100 Subject: Clearer error message when trying to read/write setting that don't exist (or are not where the user's looking). --- root_commands.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'root_commands.c') diff --git a/root_commands.c b/root_commands.c index 5b761bb6..ad886f57 100644 --- a/root_commands.c +++ b/root_commands.c @@ -266,6 +266,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 +310,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 -- cgit v1.2.3 From 180ab31c09a9990a135b78fd6d52de5b093550f2 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 21 Aug 2010 20:34:17 +0100 Subject: Added some neat whatsnew code that keeps track of the newest version of BitlBee used by a user, and if it looks like s/he hasn't used this one before, show a list of new features that may be interesting. Since I don't think im.bitlbee.org users will read any changelogs ever, this is probably not a bad idea. If you hate it, the following command should get rid of it forever: set last_version 9999999 --- root_commands.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) (limited to 'root_commands.c') diff --git a/root_commands.c b/root_commands.c index ad886f57..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. @@ -335,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; } } @@ -1279,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 }, -- cgit v1.2.3