diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2021-09-03 13:43:07 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2021-09-03 13:43:07 +0200 |
commit | 5fb7ebdfce61f038402a54d7f6dd9d74edab4d9f (patch) | |
tree | a20d3c3bcfe98b9f482edefa6d0d7288dcf5f68e /src/plugins | |
parent | 6fc6166cfe6c1ee4b6a2a8451b318bcf4f7fafb4 (diff) | |
download | weechat-5fb7ebdfce61f038402a54d7f6dd9d74edab4d9f.zip |
irc: fix send of empty JOIN when connecting to a server with only parted channels (closes #1638)
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/irc/irc-server.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index 75519fb0e..a0d27bc86 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -5519,6 +5519,8 @@ irc_server_autojoin_create_buffers (struct t_irc_server *server) * * #channel1,#channel2,#channel3 key1,key2 * + * Returns NULL if no channels have been found. + * * Note: result must be freed after use. */ @@ -5527,6 +5529,7 @@ irc_server_build_autojoin (struct t_irc_server *server) { struct t_irc_channel *ptr_channel; char **channels_with_key, **channels_others, **keys; + int num_channels; channels_with_key = NULL; channels_others = NULL; @@ -5542,6 +5545,8 @@ irc_server_build_autojoin (struct t_irc_server *server) if (!keys) goto error; + num_channels = 0; + for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { @@ -5569,9 +5574,13 @@ irc_server_build_autojoin (struct t_irc_server *server) ptr_channel->name, -1); } + num_channels++; } } + if (num_channels == 0) + goto error; + /* * concatenate channels_with_key + channels_others + keys * into channels_with_key |