From d46389ae4050a27fde2f221d31555edeeeef058d Mon Sep 17 00:00:00 2001 From: Ghom <42542238+Ghommie@users.noreply.github.com> Date: Wed, 25 Aug 2021 15:18:57 +0200 Subject: [PATCH] Fixes the cross comms exemption of the current server. (#60951) Added a lowercase variable to string, string lists and keyed list configs. Currently lowercase is only TRUE for keyed lists because they have been working like that since 2018. It might be changed to be FALSE by default but it'll take a while looking at the parsed logs for the config entries. --- code/controllers/configuration/config_entry.dm | 14 ++++++++++++-- code/controllers/configuration/entries/comms.dm | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/code/controllers/configuration/config_entry.dm b/code/controllers/configuration/config_entry.dm index db991971f01..858f7f8073b 100644 --- a/code/controllers/configuration/config_entry.dm +++ b/code/controllers/configuration/config_entry.dm @@ -96,6 +96,8 @@ default = "" abstract_type = /datum/config_entry/string var/auto_trim = TRUE + /// whether the string will be lowercased on ValidateAndSet or not. + var/lowercase = FALSE /datum/config_entry/string/vv_edit_var(var_name, var_value) return var_name != NAMEOF(src, auto_trim) && ..() @@ -104,6 +106,8 @@ if(!VASProcCallGuard(str_val)) return FALSE config_entry_value = auto_trim ? trim(str_val) : str_val + if(lowercase) + config_entry_value = lowertext(config_entry_value) return TRUE /datum/config_entry/number @@ -143,13 +147,15 @@ abstract_type = /datum/config_entry/str_list default = list() dupes_allowed = TRUE + /// whether the string elements will be lowercased on ValidateAndSet or not. + var/lowercase = FALSE /datum/config_entry/str_list/ValidateAndSet(str_val) if (!VASProcCallGuard(str_val)) return FALSE str_val = trim(str_val) if (str_val != "") - config_entry_value += str_val + config_entry_value += lowercase ? lowertext(str_val) : str_val return TRUE /datum/config_entry/number_list @@ -180,6 +186,8 @@ var/key_mode var/value_mode var/splitter = " " + /// whether the key names will be lowercased on ValidateAndSet or not. + var/lowercase_key = TRUE /datum/config_entry/keyed_list/New() . = ..() @@ -196,7 +204,9 @@ var/key_value = null if(key_pos || value_mode == VALUE_MODE_FLAG) - key_name = lowertext(copytext(str_val, 1, key_pos)) + key_name = copytext(str_val, 1, key_pos) + if(lowercase_key) + key_name = lowertext(key_name) if(key_pos) key_value = copytext(str_val, key_pos + length(str_val[key_pos])) var/new_key diff --git a/code/controllers/configuration/entries/comms.dm b/code/controllers/configuration/entries/comms.dm index 2408d4a58c1..cc7228f9043 100644 --- a/code/controllers/configuration/entries/comms.dm +++ b/code/controllers/configuration/entries/comms.dm @@ -8,6 +8,7 @@ key_mode = KEY_MODE_TEXT value_mode = VALUE_MODE_TEXT protection = CONFIG_ENTRY_LOCKED + lowercase_key = FALSE // The names of the servers are proper nouns. Also required for the cross_comms_name config to work. /datum/config_entry/keyed_list/cross_server/ValidateAndSet(str_val) . = ..()