diff options
-rw-r--r-- | doc/user-guide/commands.xml | 10 | ||||
-rw-r--r-- | doc/user-guide/misc.xml | 17 | ||||
-rw-r--r-- | irc_commands.c | 4 | ||||
-rw-r--r-- | root_commands.c | 42 |
4 files changed, 67 insertions, 6 deletions
diff --git a/doc/user-guide/commands.xml b/doc/user-guide/commands.xml index 97c54bae..bba2df73 100644 --- a/doc/user-guide/commands.xml +++ b/doc/user-guide/commands.xml @@ -1113,7 +1113,7 @@ </bitlbee-command> <bitlbee-command name="identify"> - <syntax>identify <password></syntax> + <syntax>identify [-noload|-force] <password></syntax> <short-description>Identify yourself with your password</short-description> <description> @@ -1124,6 +1124,14 @@ <para> Once you're registered, you can change your password using <emphasis>set password <password></emphasis>. </para> + + <para> + The <emphasis>-noload</emphasis> and <emphasis>-force</emphasis> flags can be used to identify when you're logged into some IM accounts already. <emphasis>-force</emphasis> will let you identify yourself and load all saved accounts (and keep the accounts you're logged into already). + </para> + + <para> + <emphasis>-noload</emphasis> will log you in but not load any accounts and settings saved under your current nickname. These will be overwritten once you save your settings (i.e. when you disconnect). + </para> </description> </bitlbee-command> diff --git a/doc/user-guide/misc.xml b/doc/user-guide/misc.xml index a926775a..2427ef69 100644 --- a/doc/user-guide/misc.xml +++ b/doc/user-guide/misc.xml @@ -116,4 +116,21 @@ If you want to set an away state for only one of your connections, you can use t </sect1> +<sect1 id="nick_changes"> +<title>Changing your nickname</title> + +<para> +BitlBee now allows you to change your nickname. So far this was not possible because it made managing saved accounts more complicated. +</para> + +<para> +The restriction no longer exists now though. When you change your nick (just using the <emphasis>/nick</emphasis> command), your logged-in status will be reset, which means any changes made to your settings/accounts will not be saved. +</para> + +<para> +To restore your logged-in status, you need to either use the <emphasis>register</emphasis> command to create an account under the new nickname, or use <emphasis>identify -noload</emphasis> to re-identify yourself under the new nickname. The <emphasis>-noload</emphasis> flag tells the command to verify your password and log you in, but not load any new settings. See <emphasis>help identify</emphasis> for more information. +</para> + +</sect1> + </chapter> diff --git a/irc_commands.c b/irc_commands.c index 4ea53299..4ce68f07 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -88,6 +88,10 @@ static void irc_cmd_nick( irc_t *irc, char **cmd ) irc_setpass( irc, NULL ); irc->status &= ~USTATUS_IDENTIFIED; irc_umode_set( irc, "-R", 1 ); + irc_usermsg( irc, "Changing nicks resets your identify status. " + "Re-identify or register a new account if you want " + "your configuration to be saved. See \x02help " + "nick_changes\x02." ); } irc_user_set_nick( irc->user, cmd[1] ); diff --git a/root_commands.c b/root_commands.c index cdc1ccdb..bb9b26cd 100644 --- a/root_commands.c +++ b/root_commands.c @@ -104,15 +104,46 @@ static void cmd_account( irc_t *irc, char **cmd ); static void cmd_identify( irc_t *irc, char **cmd ) { - storage_status_t status = storage_load( irc, cmd[1] ); + storage_status_t status; char *account_on[] = { "account", "on", NULL }; + gboolean load = TRUE; + char *password = cmd[1]; - if( strchr( irc->umode, 'R' ) != NULL ) + if( irc->status & USTATUS_IDENTIFIED ) { irc_usermsg( irc, "You're already logged in." ); return; } + if( strncmp( cmd[1], "-no", 3 ) == 0 ) + { + load = FALSE; + password = cmd[2]; + } + else if( strncmp( cmd[1], "-force", 6 ) == 0 ) + { + password = cmd[2]; + } + else if( irc->b->accounts != NULL ) + { + irc_usermsg( irc, + "You're trying to identify yourself, but already have " + "at least one IM account set up. " + "Use \x02identify -noload\x02 or \x02identify -force\x02 " + "instead (see \x02help identify\x02)." ); + return; + } + + if( password == NULL ) + { + MIN_ARGS( 2 ); + } + + if( load ) + status = storage_load( irc, password ); + else + status = storage_check_pass( irc->user->nick, password ); + switch (status) { case STORAGE_INVALID_PASSWORD: irc_usermsg( irc, "Incorrect password" ); @@ -121,11 +152,12 @@ static void cmd_identify( irc_t *irc, char **cmd ) irc_usermsg( irc, "The nick is (probably) not registered" ); break; case STORAGE_OK: - irc_usermsg( irc, "Password accepted, settings and accounts loaded" ); - irc_setpass( irc, cmd[1] ); + irc_usermsg( irc, "Password accepted%s", + load ? ", settings and accounts loaded" : "" ); + irc_setpass( irc, password ); irc->status |= USTATUS_IDENTIFIED; irc_umode_set( irc, "+R", 1 ); - if( set_getbool( &irc->b->set, "auto_connect" ) ) + if( load && set_getbool( &irc->b->set, "auto_connect" ) ) cmd_account( irc, account_on ); break; case STORAGE_OTHER_ERROR: |