[MIRROR] Fixes admin observer special radio keys double sanitizing input (#6871)

* Fixes admin observer special radio keys double sanitizing input (#60039)

Moves /mob/dead/observer/say() message sanitize code to after the special admin radio keys logic that will also sanitize.
Changes an if else chain to a switch statement,

* Fixes admin observer special radio keys double sanitizing input

Co-authored-by: Wayland-Smithy <64715958+Wayland-Smithy@users.noreply.github.com>
This commit is contained in:
SkyratBot
2021-07-12 21:48:22 +01:00
committed by GitHub
co-authored by Wayland-Smithy
parent af5951444b
commit e513d7c051
+11 -10
View File
@@ -10,22 +10,24 @@
return message
/mob/dead/observer/say(message, bubble_type, list/spans = list(), sanitize = TRUE, datum/language/language = null, ignore_spam = FALSE, forced = null)
message = trim(copytext_char(sanitize(message), 1, MAX_MESSAGE_LEN))
if (!message)
message = trim(message) //trim now and sanitize after checking for special admin radio keys
if(!message)
return
var/list/message_mods = list()
message = get_message_mods(message, message_mods)
if(client?.holder && (message_mods[RADIO_EXTENSION] == MODE_ADMIN || message_mods[RADIO_EXTENSION] == MODE_DEADMIN || (message_mods[RADIO_EXTENSION] == MODE_PUPPET && mind?.current)))
message = trim_left(copytext_char(message, length(message_mods[RADIO_KEY]) + 2))
if(message_mods[RADIO_EXTENSION] == MODE_ADMIN)
client.cmd_admin_say(message)
else if(message_mods[RADIO_EXTENSION] == MODE_DEADMIN)
client.dsay(message)
else if(message_mods[RADIO_EXTENSION] == MODE_PUPPET)
if(!mind.current.say(message))
to_chat(src, span_warning("Your linked body was unable to speak!"))
switch(message_mods[RADIO_EXTENSION])
if(MODE_ADMIN)
client.cmd_admin_say(message)
if(MODE_DEADMIN)
client.dsay(message)
if(MODE_PUPPET)
if(!mind.current.say(message))
to_chat(src, span_warning("Your linked body was unable to speak!"))
return
message = copytext_char(sanitize(message), 1, MAX_MESSAGE_LEN)
if(check_emote(message, forced))
return
@@ -51,4 +53,3 @@
to_chat(src,
html = "[link] [message]",
avoid_highlighting = speaker == src)