aboutsummaryrefslogtreecommitdiffstats
path: root/root_commands.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-07-11 01:29:19 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2010-07-11 01:29:19 +0100
commite92c4f4f63ca0ba9ac6f959f7ff894ad2fc72a04 (patch)
treec9aff24a9af5f9b8757f9174647d2e4db5a54829 /root_commands.c
parentf1c2b21af3a51796b747ca4dbc2cdec9611efc5d (diff)
Takeover stuff now works in daemon mode as well.
Diffstat (limited to 'root_commands.c')
-rw-r--r--root_commands.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/root_commands.c b/root_commands.c
index 6fa4fd54..4aeb1470 100644
--- a/root_commands.c
+++ b/root_commands.c
@@ -154,16 +154,31 @@ static void cmd_identify( irc_t *irc, char **cmd )
irc_setpass( irc, password );
irc->status |= USTATUS_IDENTIFIED;
irc_umode_set( irc, "+R", 1 );
- irc_channel_auto_joins( irc, NULL );
- if( ipc_child_identify( 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.
+ Do it in 200ms since that should give the parent process
+ enough time to come back to us. */
+ if( load )
{
- if( load && set_getbool( &irc->b->set, "auto_connect" ) )
+ irc_channel_auto_joins( irc, NULL );
+ if( 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" ) )
+
+ /* If ipc_child_identify() returns FALSE, it means we're
+ already sure that there's no takeover target (only
+ possible in 1-process daemon mode). Start auto_connect
+ immediately. */
+ if( !ipc_child_identify( irc ) && load &&
+ set_getbool( &irc->b->set, "auto_connect" ) )
+ {
+ b_event_remove( irc->login_source_id );
+ irc->login_source_id = -1;
cmd_identify_finish( irc, 0, 0 );
+ }
break;
case STORAGE_OTHER_ERROR: