summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-04-05 20:56:48 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-04-05 20:56:48 +0200
commit87216279cae1d3b8a7fb13031dfd00ab0452fd35 (patch)
treef9212b32d4c0e911205dbfb61914ddf1bca72a9a /src
parentb6a59be3172cb389e9170b1d60346fa7e8b5a534 (diff)
downloadweechat-87216279cae1d3b8a7fb13031dfd00ab0452fd35.zip
irc: display a warning if CTCP name in option `irc.ctcp.*` is not lower case
Diffstat (limited to 'src')
-rw-r--r--src/plugins/irc/irc-config.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index bc243b15f..aa6d4677c 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -1471,9 +1471,9 @@ irc_config_ctcp_create_option (const void *pointer, void *data,
{
struct t_config_option *ptr_option;
int rc;
- const char *default_value;
+ const char *default_value, *pos_name;
+ char *name_lower;
static char empty_value[1] = { '\0' };
- const char *pos_name;
/* make C compiler happy */
(void) pointer;
@@ -1506,6 +1506,20 @@ irc_config_ctcp_create_option (const void *pointer, void *data,
if (!default_value)
default_value = empty_value;
+ name_lower = weechat_string_tolower (pos_name);
+ if (name_lower && (strcmp (pos_name, name_lower) != 0))
+ {
+ weechat_printf (
+ NULL,
+ _("%s%s: warning: the CTCP name \"%s\" must be "
+ "lower case, the option \"irc.ctcp.%s\" will "
+ "not work"),
+ weechat_prefix ("error"), IRC_PLUGIN_NAME, pos_name,
+ option_name);
+ }
+ if (name_lower)
+ free (name_lower);
+
ptr_option = weechat_config_new_option (
config_file, section,
option_name, "string",