summaryrefslogtreecommitdiff
path: root/src/plugins/irc
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-04-05 20:36:06 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-04-05 20:47:20 +0200
commitb6a59be3172cb389e9170b1d60346fa7e8b5a534 (patch)
tree77015d1d00bb912cea6078737fadad429cb490df /src/plugins/irc
parente75c61d7aa892a2daeea352e2011d65b219feb99 (diff)
downloadweechat-b6a59be3172cb389e9170b1d60346fa7e8b5a534.zip
irc: search options `irc.ctcp.*` with lower case ctcp string
Diffstat (limited to 'src/plugins/irc')
-rw-r--r--src/plugins/irc/irc-ctcp.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/plugins/irc/irc-ctcp.c b/src/plugins/irc/irc-ctcp.c
index c37bc150c..2197867ce 100644
--- a/src/plugins/irc/irc-ctcp.c
+++ b/src/plugins/irc/irc-ctcp.c
@@ -79,23 +79,36 @@ const char *
irc_ctcp_get_reply (struct t_irc_server *server, const char *ctcp)
{
struct t_config_option *ptr_option;
- char option_name[512];
+ char option_name[512], *ctcp_lower;
- snprintf (option_name, sizeof (option_name), "%s.%s", server->name, ctcp);
+ ctcp_lower = weechat_string_tolower (ctcp);
+ if (!ctcp_lower)
+ return NULL;
+
+ snprintf (option_name, sizeof (option_name),
+ "%s.%s", server->name, ctcp_lower);
/* search for CTCP in configuration file, for server */
ptr_option = weechat_config_search_option (irc_config_file,
irc_config_section_ctcp,
option_name);
if (ptr_option)
+ {
+ free (ctcp_lower);
return weechat_config_string (ptr_option);
+ }
/* search for CTCP in configuration file */
ptr_option = weechat_config_search_option (irc_config_file,
irc_config_section_ctcp,
- ctcp);
+ ctcp_lower);
if (ptr_option)
+ {
+ free (ctcp_lower);
return weechat_config_string (ptr_option);
+ }
+
+ free (ctcp_lower);
/*
* no CTCP reply found in config, then return default reply, or NULL