diff --git a/code/__HELPERS/text.dm b/code/__HELPERS/text.dm index cc44e98b2c..dec44653af 100644 --- a/code/__HELPERS/text.dm +++ b/code/__HELPERS/text.dm @@ -53,36 +53,6 @@ /proc/sanitize(t,list/repl_chars = null) return html_encode(sanitize_simple(t,repl_chars)) -//Used for preprocessing entered text -/proc/sanitize_rp(var/input, var/max_length = MAX_MESSAGE_LEN, var/encode = 1, var/trim = 1, var/extra = 1) - if(!input) - return - - if(max_length) - input = copytext(input,1,max_length) - - if(extra) - var/temp_input = replace_characters(input, list("\n"=" ","\t"=" "))//one character is replaced by two - if(length_char(input) < (length_char(temp_input) - 12)) //12 is the number of linebreaks allowed per message - input = replace_characters(temp_input,list(" "=" "))//replace again, this time the double spaces with single ones - - if(encode) - // The below \ escapes have a space inserted to attempt to enable Travis auto-checking of span class usage. Please do not remove the space. - //In addition to processing html, html_encode removes byond formatting codes like "\ red", "\ i" and other. - //It is important to avoid double-encode text, it can "break" quotes and some other characters. - //Also, keep in mind that escaped characters don't work in the interface (window titles, lower left corner of the main window, etc.) - input = html_encode(input) - else - //If not need encode text, simply remove < and > - //note: we can also remove here byond formatting codes: 0xFF + next byte - input = replace_characters(input, list("<"=" ", ">"=" ")) - - if(trim) - //Maybe, we need trim text twice? Here and before copytext? - input = trim(input) - - return input - //Runs sanitize and strip_html_simple //I believe strip_html_simple() is required to run first to prevent '<' from displaying as '<' after sanitize() calls byond's html_encode() /proc/strip_html(t,limit=MAX_MESSAGE_LEN) diff --git a/code/modules/mob/say.dm b/code/modules/mob/say.dm index ace632f3ed..8261c5ae8e 100644 --- a/code/modules/mob/say.dm +++ b/code/modules/mob/say.dm @@ -54,7 +54,7 @@ to_chat(usr, "^^^----- The preceeding message has been DISCARDED for being over the maximum length of [MAX_MESSAGE_LEN]. It has NOT been sent! -----^^^") return - message = trim(copytext_char(sanitize_rp(message), 1, MAX_MESSAGE_LEN)) + message = trim(html_encode(message), MAX_MESSAGE_LEN) clear_typing_indicator() // clear it immediately! client?.last_activity = world.time