Closed irssibot closed 14 years ago
patch-src_irc_core_irc-servers-reconnect_c
--- src/irc/core/irc-servers-reconnect.c.orig 2009-07-09 08:51:19.000000000 +0100
+++ src/irc/core/irc-servers-reconnect.c 2009-07-09 11:53:10.000000000 +0100
@@ -59,7 +59,8 @@
return;
g_free_not_null(conn->channels);
- conn->channels = irc_server_get_channels(server);
+ conn->channels = server->connrec->no_autojoin_channels ? NULL :
+ irc_server_get_channels(server);
g_free_not_null(conn->usermode);
conn->usermode = g_strdup(server->wanted_usermode);
-! is about not joining the channels in /channels list. Rejoining channels you were in previously when reconnecting is something really different. If we add something to disable the rejoining on reconnect, it should be a different setting.
There's two distinct issues here then - generically not rejoining any channels on reconnect (I'll submit a patch for that as a seperate item) and honouring -! across reconnects.
If a user /connect's with -! , I think there's a reasonable expectation that the auto-join channels aren't rejoined on a reconnection. Does this then mean that only auto-join channels shouldn't be rejoined and that manually joined channels should be rejoined? Or is it better to consider not rejoining any channels on reconnection (when -! is used)?
Currently, "/channel add -auto" (and -!) only affect the first time you connect. When reconnecting, Irssi doesn't care about if a channel is or isn't added as channel to be autojoined on connect. So talking about an option that disables rejoining auto-join channels doesn't make sense: it never does that. If you /part a channel you have in /channel add -auto, and then reconnect, you don't join the channel again.
Your reasonable expectation should already be the case (unless you joined the channels manually before reconnecting).
Correct me if I'm wrong here (but I even just tested it again to be really sure).
I've just re-tested and you're right - I must have confused myself. My apologies for wasting your time.
As per comments in #irssi, please find attached a patch which provides support for toggleable rejoin-channels-on-reconnect functionality.
patch-channels-rejoin-on-reconnect.diff
--- src/irc/core/irc-servers-reconnect.c.orig 2010-03-24 03:27:41.000000000 +0000
+++ src/irc/core/irc-servers-reconnect.c 2010-03-24 03:30:26.000000000 +0000
@@ -59,7 +59,8 @@
return;
g_free_not_null(conn->channels);
- conn->channels = irc_server_get_channels(server);
+ conn->channels = settings_get_bool("channels_rejoin_on_reconnect") ?
+ irc_server_get_channels(server) : NULL;
g_free_not_null(conn->usermode);
conn->usermode = g_strdup(server->wanted_usermode);
--- src/core/servers-reconnect.c.orig 2008-08-25 23:00:02.000000000 +0100
+++ src/core/servers-reconnect.c 2010-03-24 03:32:40.000000000 +0000
@@ -35,6 +35,7 @@
static int reconnect_timeout_tag;
static int reconnect_time;
static int connect_timeout;
+static int channels_rejoin;
void reconnect_save_status(SERVER_CONNECT_REC *conn, SERVER_REC *server)
{
@@ -51,8 +52,11 @@
/* XXX when is reconnect_save_status() called with
* server->connected==FALSE? */
g_free_not_null(conn->channels);
- conn->channels = server->connrec->no_autojoin_channels ? NULL :
- g_strdup(server->connrec->channels);
+ if (server->connrec->no_autojoin_channels || !channels_rejoin) {
+ conn->channels = NULL;
+ } else {
+ conn->channels = g_strdup(server->connrec->channels);
+ }
}
signal_emit("server reconnect save status", 2, conn, server);
@@ -468,12 +472,14 @@
{
reconnect_time = settings_get_time("server_reconnect_time")/1000;
connect_timeout = settings_get_time("server_connect_timeout")/1000;
+ channels_rejoin = settings_get_str("channels_rejoin_on_reconnect");
}
void servers_reconnect_init(void)
{
settings_add_time("server", "server_reconnect_time", "5min");
settings_add_time("server", "server_connect_timeout", "5min");
+ settings_add_bool("servers", "channels_rejoin_on_reconnect", TRUE);
reconnects = NULL;
last_reconnect_tag = 0;
Please ignore the previous patch - it contains a braindead typo (erroneously used settings_get_str instead of settings_get_bool).
patch-channels-rejoin-on-reconnect.diff
--- src/irc/core/irc-servers-reconnect.c.orig 2010-03-24 03:27:41.000000000 +0000
+++ src/irc/core/irc-servers-reconnect.c 2010-03-24 03:30:26.000000000 +0000
@@ -59,7 +59,8 @@
return;
g_free_not_null(conn->channels);
- conn->channels = irc_server_get_channels(server);
+ conn->channels = settings_get_bool("channels_rejoin_on_reconnect") ?
+ irc_server_get_channels(server) : NULL;
g_free_not_null(conn->usermode);
conn->usermode = g_strdup(server->wanted_usermode);
--- src/core/servers-reconnect.c.orig 2008-08-25 23:00:02.000000000 +0100
+++ src/core/servers-reconnect.c 2010-03-24 03:32:40.000000000 +0000
@@ -35,6 +35,7 @@
static int reconnect_timeout_tag;
static int reconnect_time;
static int connect_timeout;
+static int channels_rejoin;
void reconnect_save_status(SERVER_CONNECT_REC *conn, SERVER_REC *server)
{
@@ -51,8 +52,11 @@
/* XXX when is reconnect_save_status() called with
* server->connected==FALSE? */
g_free_not_null(conn->channels);
- conn->channels = server->connrec->no_autojoin_channels ? NULL :
- g_strdup(server->connrec->channels);
+ if (server->connrec->no_autojoin_channels || !channels_rejoin) {
+ conn->channels = NULL;
+ } else {
+ conn->channels = g_strdup(server->connrec->channels);
+ }
}
signal_emit("server reconnect save status", 2, conn, server);
@@ -468,12 +472,14 @@
{
reconnect_time = settings_get_time("server_reconnect_time")/1000;
connect_timeout = settings_get_time("server_connect_timeout")/1000;
+ channels_rejoin = settings_get_bool("channels_rejoin_on_reconnect");
}
void servers_reconnect_init(void)
{
settings_add_time("server", "server_reconnect_time", "5min");
settings_add_time("server", "server_connect_timeout", "5min");
+ settings_add_bool("servers", "channels_rejoin_on_reconnect", TRUE);
reconnects = NULL;
last_reconnect_tag = 0;
See also #639: it might be nice to have a setting with three possible values...
Somewhat a duplicate of #639
Duplicate of #639. See #639.
If you connect to a server with /connect -! , if a reconnection occurs, the connection record's no_autojoin_channels is not honoured and you are rejoined to all channels you were in at the point of disconnection.