Skip to content

Commit a7e0aee

Browse files
[MIRROR] Fixes the cross comms exemption of the current server. (#342)
* 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. * Fixes the cross comms exemption of the current server. Co-authored-by: Ghom <[email protected]>
1 parent f8ad96b commit a7e0aee

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

code/controllers/configuration/config_entry.dm

+12-2
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@
9696
default = ""
9797
abstract_type = /datum/config_entry/string
9898
var/auto_trim = TRUE
99+
/// whether the string will be lowercased on ValidateAndSet or not.
100+
var/lowercase = FALSE
99101

100102
/datum/config_entry/string/vv_edit_var(var_name, var_value)
101103
return var_name != NAMEOF(src, auto_trim) && ..()
@@ -104,6 +106,8 @@
104106
if(!VASProcCallGuard(str_val))
105107
return FALSE
106108
config_entry_value = auto_trim ? trim(str_val) : str_val
109+
if(lowercase)
110+
config_entry_value = lowertext(config_entry_value)
107111
return TRUE
108112

109113
/datum/config_entry/number
@@ -143,13 +147,15 @@
143147
abstract_type = /datum/config_entry/str_list
144148
default = list()
145149
dupes_allowed = TRUE
150+
/// whether the string elements will be lowercased on ValidateAndSet or not.
151+
var/lowercase = FALSE
146152

147153
/datum/config_entry/str_list/ValidateAndSet(str_val)
148154
if (!VASProcCallGuard(str_val))
149155
return FALSE
150156
str_val = trim(str_val)
151157
if (str_val != "")
152-
config_entry_value += str_val
158+
config_entry_value += lowercase ? lowertext(str_val) : str_val
153159
return TRUE
154160

155161
/datum/config_entry/number_list
@@ -180,6 +186,8 @@
180186
var/key_mode
181187
var/value_mode
182188
var/splitter = " "
189+
/// whether the key names will be lowercased on ValidateAndSet or not.
190+
var/lowercase_key = TRUE
183191

184192
/datum/config_entry/keyed_list/New()
185193
. = ..()
@@ -196,7 +204,9 @@
196204
var/key_value = null
197205

198206
if(key_pos || value_mode == VALUE_MODE_FLAG)
199-
key_name = lowertext(copytext(str_val, 1, key_pos))
207+
key_name = copytext(str_val, 1, key_pos)
208+
if(lowercase_key)
209+
key_name = lowertext(key_name)
200210
if(key_pos)
201211
key_value = copytext(str_val, key_pos + length(str_val[key_pos]))
202212
var/new_key

code/controllers/configuration/entries/comms.dm

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
key_mode = KEY_MODE_TEXT
99
value_mode = VALUE_MODE_TEXT
1010
protection = CONFIG_ENTRY_LOCKED
11+
lowercase_key = FALSE // The names of the servers are proper nouns. Also required for the cross_comms_name config to work.
1112

1213
/datum/config_entry/keyed_list/cross_server/ValidateAndSet(str_val)
1314
. = ..()

0 commit comments

Comments
 (0)