1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

irc: fix creation of irc.msgbuffer option without a server name

The regression was introduced by commit
1b669cd13c, which allowed a server name with
upper case but rejected a name or alias with upper case.

This commit fixed the creation of the option when the server name is not given,
so this command works again:

  /set irc.msgbuffer.whois current
This commit is contained in:
Sébastien Helleu
2025-12-01 07:43:35 +01:00
parent 234a37df6f
commit 1ff001994c
2 changed files with 28 additions and 29 deletions
+1
View File
@@ -11,6 +11,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
### Fixed
- core: fix buffer size in function util_parse_time, causing buffer overflow error in unit tests
- irc: fix creation of irc.msgbuffer option without a server name
## Version 4.8.0 (2025-11-30)
+27 -29
View File
@@ -1577,7 +1577,8 @@ irc_config_msgbuffer_create_option_cb (const void *pointer, void *data,
const char *option_name, const char *value)
{
struct t_config_option *ptr_option;
char *pos, *name_lower;
const char *pos;
char *name_lower;
int rc;
/* make C compiler happy */
@@ -1605,36 +1606,33 @@ irc_config_msgbuffer_create_option_cb (const void *pointer, void *data,
if (value)
{
pos = strrchr (option_name, '.');
if (pos)
pos = (pos) ? pos + 1 : option_name;
name_lower = weechat_string_tolower (pos);
if (name_lower && (strcmp (pos, name_lower) == 0))
{
pos++;
name_lower = weechat_string_tolower (pos);
if (name_lower && (strcmp (pos, name_lower) == 0))
{
ptr_option = weechat_config_new_option (
config_file, section,
option_name, "enum",
_("buffer used to display message received from IRC "
"server"),
"weechat|server|current|private", 0, 0, value, value, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE :
WEECHAT_CONFIG_OPTION_SET_ERROR;
}
else
{
weechat_printf (
NULL,
_("%s%s: error: invalid option \"%s.%s\", the command "
"name or alias \"%s\" must be lower case"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
"irc.msgbuffer", option_name, pos);
free (name_lower);
return rc;
}
free (name_lower);
ptr_option = weechat_config_new_option (
config_file, section,
option_name, "enum",
_("buffer used to display message received from IRC "
"server"),
"weechat|server|current|private", 0, 0, value, value, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE :
WEECHAT_CONFIG_OPTION_SET_ERROR;
}
else
{
weechat_printf (
NULL,
_("%s%s: error: invalid option \"%s.%s\", the command "
"name or alias \"%s\" must be lower case"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
"irc.msgbuffer", option_name, pos);
free (name_lower);
return rc;
}
free (name_lower);
}
else
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;