diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2021-01-30 09:31:31 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2021-01-30 09:31:31 +0100 |
commit | dd589cd141bc2d872cd2190fede31c37b2cd770f (patch) | |
tree | df432f848b65f3cf956a31cb4f3de2d03923c12d /src | |
parent | e305b4e960cc4511e78b13191abacd398cfef6e3 (diff) | |
download | weechat-dd589cd141bc2d872cd2190fede31c37b2cd770f.zip |
irc: use server option "default_chantypes" as fallback when automatically adding channel type on join
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/irc/irc-channel.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index fd97c3fa5..cd5d034e7 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -699,21 +699,27 @@ irc_channel_get_auto_chantype (struct t_irc_server *server, const char *channel_name) { static char chantype[2]; + const char *ptr_chantypes; chantype[0] = '\0'; chantype[1] = '\0'; if (weechat_config_boolean (irc_config_look_join_auto_add_chantype) - && !irc_channel_is_channel (server, channel_name) - && server->chantypes - && server->chantypes[0]) + && !irc_channel_is_channel (server, channel_name)) { - /* - * use '#' if it's in chantypes (anywhere in the string), because it is - * the most common channel type, and fallback on first channel type - */ - chantype[0] = (strchr (server->chantypes, '#')) ? - '#' : server->chantypes[0]; + ptr_chantypes = (server->chantypes) ? + server->chantypes : + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_DEFAULT_CHANTYPES); + if (ptr_chantypes && ptr_chantypes[0]) + { + /* + * use '#' if it's in chantypes (anywhere in the string), because + * it is the most common channel type, and fallback on first + * channel type + */ + chantype[0] = (strchr (ptr_chantypes, '#')) ? + '#' : ptr_chantypes[0]; + } } return chantype; |