aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/user-guide/commands.xml10
-rw-r--r--ipc.c13
-rw-r--r--irc.c4
-rw-r--r--root_commands.c5
4 files changed, 25 insertions, 7 deletions
diff --git a/doc/user-guide/commands.xml b/doc/user-guide/commands.xml
index 4154fb27..be61e4db 100644
--- a/doc/user-guide/commands.xml
+++ b/doc/user-guide/commands.xml
@@ -420,6 +420,16 @@
</description>
</bitlbee-setting>
+ <bitlbee-setting name="allow_takeover" type="boolean" scope="global">
+ <default>true</default>
+
+ <description>
+ <para>
+ When you're already connected to a BitlBee server and you connect (and identify) again, BitlBee will offer to migrate your existing session to the new connection. If for whatever reason you don't want this, you can disable this setting.
+ </para>
+ </description>
+ </bitlbee-setting>
+
<bitlbee-setting name="auto_connect" type="boolean" scope="both">
<default>true</default>
diff --git a/ipc.c b/ipc.c
index 9a100465..26fe7b30 100644
--- a/ipc.c
+++ b/ipc.c
@@ -316,6 +316,12 @@ static void ipc_child_cmd_takeover( irc_t *irc, char **cmd )
else if( strcmp( cmd[1], "INIT" ) == 0 )
{
/* Master->New connection */
+ if( !set_getbool( &irc->b->set, "allow_takeover" ) )
+ {
+ ipc_child_cmd_takeover_no( irc );
+ return;
+ }
+
/* Offer to take over the old session, unless for some reason
we're already logging into IM connections. */
if( irc->login_source_id != -1 )
@@ -335,7 +341,8 @@ static void ipc_child_cmd_takeover( irc_t *irc, char **cmd )
if( irc->password && cmd[2] && cmd[3] &&
ipc_child_recv_fd != -1 &&
strcmp( irc->user->nick, cmd[2] ) == 0 &&
- strcmp( irc->password, cmd[3] ) == 0 )
+ strcmp( irc->password, cmd[3] ) == 0 &&
+ set_getbool( &irc->b->set, "allow_takeover" ) )
{
irc_switch_fd( irc, ipc_child_recv_fd );
irc_sync( irc );
@@ -463,7 +470,9 @@ gboolean ipc_child_identify( irc_t *irc )
strcmp( irc->password, old->password ) == 0 )
break;
}
- if( l == NULL )
+ if( l == NULL ||
+ !set_getbool( &irc->b->set, "allow_takeover" ) ||
+ !set_getbool( &old->b->set, "allow_takeover" ) )
return FALSE;
ipc_child_cmd_takeover( irc, to_init );
diff --git a/irc.c b/irc.c
index f616ef40..10fbea23 100644
--- a/irc.c
+++ b/irc.c
@@ -99,6 +99,7 @@ irc_t *irc_new( int fd )
b->ui_data = irc;
b->ui = &irc_ui_funcs;
+ s = set_add( &b->set, "allow_takeover", "true", set_eval_bool, irc );
s = set_add( &b->set, "away_devoice", "true", set_eval_away_devoice, irc );
s = set_add( &b->set, "away_reply_timeout", "3600", set_eval_int, irc );
s = set_add( &b->set, "charset", "utf-8", set_eval_charset, irc );
@@ -658,8 +659,9 @@ void irc_switch_fd( irc_t *irc, int fd )
if( irc->sendbuffer )
{
b_event_remove( irc->w_watch_source_id );
+ irc->w_watch_source_id = 0;
g_free( irc->sendbuffer );
- irc->sendbuffer = irc->w_watch_source_id = 0;
+ irc->sendbuffer = NULL;
}
b_event_remove( irc->r_watch_source_id );
diff --git a/root_commands.c b/root_commands.c
index 4aeb1470..d19feae0 100644
--- a/root_commands.c
+++ b/root_commands.c
@@ -174,11 +174,7 @@ static void cmd_identify( irc_t *irc, char **cmd )
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:
@@ -195,6 +191,7 @@ gboolean cmd_identify_finish( gpointer data, gint fd, b_input_condition cond )
cmd_account( irc, account_on );
+ b_event_remove( irc->login_source_id );
irc->login_source_id = -1;
return FALSE;
}