diff options
-rw-r--r-- | ChangeLog.adoc | 1 | ||||
-rw-r--r-- | src/plugins/irc/irc-buffer.c | 15 | ||||
-rw-r--r-- | src/plugins/irc/irc.c | 5 | ||||
-rw-r--r-- | src/plugins/irc/irc.h | 1 |
4 files changed, 21 insertions, 1 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 4873ca666..138a7e7ba 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -29,6 +29,7 @@ Bug fixes:: * core: fix bad window size on startup with some terminals like https://github.com/kovidgoyal/kitty[kitty] (issue #1769) * buflist: fix memory leak when reading config and changing option buflist.look.sort + * irc: remove channel from autojoin option when manually closing a buffer with `/buffer close` or `/close` * irc: fix add of channel to autojoin option when joining a channel with a buffer still opened * relay: fix save of channels in autojoin option when JOIN and PART commands are received from an IRC relay client (issue #1771) * trigger: add `${buffer.notify} > 0` in conditions of default trigger "beep" diff --git a/src/plugins/irc/irc-buffer.c b/src/plugins/irc/irc-buffer.c index 1cb129c8d..f29b5ffe2 100644 --- a/src/plugins/irc/irc-buffer.c +++ b/src/plugins/irc/irc-buffer.c @@ -30,6 +30,7 @@ #include "irc-channel.h" #include "irc-command.h" #include "irc-config.h" +#include "irc-join.h" #include "irc-raw.h" #include "irc-server.h" @@ -181,6 +182,20 @@ irc_buffer_close_cb (const void *pointer, void *data, { if (ptr_channel) { + /* + * remove channel from autojoin if autojoin_dynamic is set, + * still connected to server and not quitting/upgrading WeeChat + */ + if (ptr_server + && IRC_SERVER_OPTION_BOOLEAN(ptr_server, + IRC_SERVER_OPTION_AUTOJOIN_DYNAMIC) + && ptr_server->is_connected + && !irc_signal_quit_received + && !irc_signal_upgrade_received) + { + irc_join_remove_channel_from_autojoin (ptr_server, + ptr_channel->name); + } /* send PART for channel if its buffer is closed */ if ((ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL) && (ptr_channel->nicks)) diff --git a/src/plugins/irc/irc.c b/src/plugins/irc/irc.c index e51a8f05f..e0c892dae 100644 --- a/src/plugins/irc/irc.c +++ b/src/plugins/irc/irc.c @@ -58,7 +58,8 @@ struct t_weechat_plugin *weechat_irc_plugin = NULL; struct t_hook *irc_hook_timer = NULL; -int irc_signal_upgrade_received = 0; /* signal "upgrade" received ? */ +int irc_signal_quit_received = 0; /* signal "quit" received? */ +int irc_signal_upgrade_received = 0; /* signal "upgrade" received? */ /* @@ -77,6 +78,8 @@ irc_signal_quit_cb (const void *pointer, void *data, (void) data; (void) signal; + irc_signal_quit_received = 1; + if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0) { for (ptr_server = irc_servers; ptr_server; diff --git a/src/plugins/irc/irc.h b/src/plugins/irc/irc.h index cc1ecefb1..519ac1685 100644 --- a/src/plugins/irc/irc.h +++ b/src/plugins/irc/irc.h @@ -26,6 +26,7 @@ extern struct t_weechat_plugin *weechat_irc_plugin; +extern int irc_signal_quit_received; extern int irc_signal_upgrade_received; #endif /* WEECHAT_PLUGIN_IRC_H */ |