From 6c2404e051cb6a235f985797c149af0791f44bbd Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Tue, 6 Jul 2010 22:44:52 +0100 Subject: First part of the handshake, including sending a file descriptor to the IPC master. --- root_commands.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'root_commands.c') diff --git a/root_commands.c b/root_commands.c index 62fe1e79..5d84c6d4 100644 --- a/root_commands.c +++ b/root_commands.c @@ -104,7 +104,6 @@ static void cmd_account( irc_t *irc, char **cmd ); static void cmd_identify( irc_t *irc, char **cmd ) { storage_status_t status; - char *account_on[] = { "account", "on", NULL }; gboolean load = TRUE; char *password = cmd[1]; @@ -157,8 +156,16 @@ static void cmd_identify( irc_t *irc, char **cmd ) irc->status |= USTATUS_IDENTIFIED; irc_umode_set( irc, "+R", 1 ); irc_channel_auto_joins( irc, NULL ); - if( load && set_getbool( &irc->b->set, "auto_connect" ) ) - cmd_account( irc, account_on ); + + if( ipc_child_identify( irc ) ) + { + if( load && set_getbool( &irc->b->set, "auto_connect" ) ) + irc->login_source_id = b_timeout_add( 200, + cmd_identify_finish, irc ); + } + else if( load && set_getbool( &irc->b->set, "auto_connect" ) ) + cmd_identify_finish( irc, 0, 0 ); + break; case STORAGE_OTHER_ERROR: default: @@ -167,6 +174,16 @@ static void cmd_identify( irc_t *irc, char **cmd ) } } +gboolean cmd_identify_finish( gpointer data, gint fd, b_input_condition cond ) +{ + char *account_on[] = { "account", "on", NULL }; + irc_t *irc = data; + + cmd_account( irc, account_on ); + + return FALSE; +} + static void cmd_register( irc_t *irc, char **cmd ) { if( global.conf->authmode == AUTHMODE_REGISTERED ) @@ -671,7 +688,7 @@ static void cmd_rename( irc_t *irc, char **cmd ) } else if( iu == irc->user ) { - irc_usermsg( irc, "Nick `%s' can't be changed", cmd[1] ); + irc_usermsg( irc, "Use /nick to change your own nickname" ); } else if( !nick_ok( cmd[2] ) ) { -- cgit v1.2.3