Tiny code cleanup in conf to use allowed_channelchars_strtoval()

This commit is contained in:
Bram Matthys 2020-04-13 10:06:11 +02:00
parent d25f6f6759
commit 177d017b06
No known key found for this signature in database
GPG key ID: BF8116B163EAAE98

View file

@ -7817,12 +7817,7 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce)
}
else if (!strcmp(cep->ce_varname, "allowed-channelchars"))
{
if (!strcmp(cep->ce_vardata, "ascii"))
tempiConf.allowed_channelchars = ALLOWED_CHANNELCHARS_ASCII;
else if (!strcmp(cep->ce_vardata, "utf8"))
tempiConf.allowed_channelchars = ALLOWED_CHANNELCHARS_UTF8;
else if (!strcmp(cep->ce_vardata, "any"))
tempiConf.allowed_channelchars = ALLOWED_CHANNELCHARS_ANY;
tempiConf.allowed_channelchars = allowed_channelchars_strtoval(cep->ce_vardata);
}
else if (!strcmp(cep->ce_varname, "hide-idle-time"))
{
@ -9015,9 +9010,7 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce)
else if (!strcmp(cep->ce_varname, "allowed-channelchars"))
{
CheckNull(cep);
if (strcmp(cep->ce_vardata, "ascii") &&
strcmp(cep->ce_vardata, "utf8") &&
strcmp(cep->ce_vardata, "any"))
if (!allowed_channelchars_strtoval(cep->ce_vardata))
{
config_error("%s:%i: set::allowed-channelchars: value should be one of: 'ascii', 'utf8' or 'any'",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum);