Skip to content

Commit

Permalink
irc: do not join channels in server autojoin option after reconnectio…
Browse files Browse the repository at this point in the history
…n to the server (closes #560, bug #21529)
  • Loading branch information
flashcode committed Dec 17, 2022
1 parent 122a0f8 commit fb31cf6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 21 deletions.
1 change: 1 addition & 0 deletions ChangeLog.adoc
Expand Up @@ -37,6 +37,7 @@ Bug fixes::
* api: send NULL values to config section callbacks in scripting API (issue #1843)
* api: fix function string_cut when there are non printable chars in suffix
* api: do not expect any return value in callbacks "callback_change" and "callback_delete" of function config_new_option (scripting API)
* irc: do not join channels in server autojoin option after reconnection to the server (issue #560, bug #21529)
* irc: escape backslashes in raw buffer (issue #1838)
* trigger: fix variables sent to focus callback (issue #1858)

Expand Down
48 changes: 27 additions & 21 deletions src/plugins/irc/irc-server.c
Expand Up @@ -5707,30 +5707,36 @@ irc_server_autojoin_channels (struct t_irc_server *server)
{
char *autojoin;

/* auto-join after disconnection (only rejoins opened channels) */
if (!server->disable_autojoin && server->reconnect_join && server->channels)
if (!server->disable_autojoin)
{
autojoin = irc_server_build_autojoin (server);
if (autojoin)
/* auto-join after disconnection (only rejoins opened channels) */
if (server->reconnect_join)
{
irc_server_sendf (server,
IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"JOIN %s",
autojoin);
free (autojoin);
if (server->channels)
{
autojoin = irc_server_build_autojoin (server);
if (autojoin)
{
irc_server_sendf (server,
IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"JOIN %s",
autojoin);
free (autojoin);
}
}
server->reconnect_join = 0;
}
else
{
/* auto-join when connecting to server for first time */
autojoin = irc_server_eval_expression (
server,
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_AUTOJOIN));
if (autojoin && autojoin[0])
irc_command_join_server (server, autojoin, 0, 0);
if (autojoin)
free (autojoin);
}
server->reconnect_join = 0;
}
else
{
/* auto-join when connecting to server for first time */
autojoin = irc_server_eval_expression (
server,
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_AUTOJOIN));
if (!server->disable_autojoin && autojoin && autojoin[0])
irc_command_join_server (server, autojoin, 0, 0);
if (autojoin)
free (autojoin);
}

server->disable_autojoin = 0;
Expand Down

0 comments on commit fb31cf6

Please sign in to comment.