diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2021-01-30 09:05:49 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2021-01-30 09:05:49 +0100 |
commit | e74dd22707df94a187a40433ff533e99e2d9c77c (patch) | |
tree | aa0544599112d24e1ee314e31fd29c47f8cb804f | |
parent | bad6dc8a57acfc935425a5467659c553fadb5393 (diff) | |
download | weechat-e74dd22707df94a187a40433ff533e99e2d9c77c.zip |
irc: simplify code in function irc_channel_is_channel
-rw-r--r-- | src/plugins/irc/irc-channel.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index 92f741de7..fd97c3fa5 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -667,19 +667,23 @@ int irc_channel_is_channel (struct t_irc_server *server, const char *string) { char first_char[2]; + const char *ptr_chantypes; if (!string) return 0; first_char[0] = string[0]; first_char[1] = '\0'; - return strpbrk( - first_char, - (server ? - (server->chantypes ? - server->chantypes : - IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_DEFAULT_CHANTYPES)) - : irc_channel_default_chantypes)) ? 1 : 0; + + /* default global chantypes if no server received */ + if (!server) + return (strpbrk (first_char, irc_channel_default_chantypes)) ? 1 : 0; + + /* server chantypes, or option "default_chantypes" as fallback */ + ptr_chantypes = (server->chantypes) ? + server->chantypes : + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_DEFAULT_CHANTYPES); + return (strpbrk (first_char, ptr_chantypes)) ? 1 : 0; } /* |