[MIRROR] encode patch (#11356)

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-08-08 05:12:54 -07:00
committed by GitHub
parent be6c681c50
commit 25d93e0895
9 changed files with 32 additions and 54 deletions

View File

@@ -83,6 +83,7 @@
#define DO_AUTOPILOT 5 #define DO_AUTOPILOT 5
#define MAX_MESSAGE_LEN 4096 #define MAX_MESSAGE_LEN 4096
#define MAX_HUGE_MESSAGE_LEN 8192
#define MAX_PAPER_MESSAGE_LEN 6144 #define MAX_PAPER_MESSAGE_LEN 6144
#define MAX_BOOK_MESSAGE_LEN 24576 #define MAX_BOOK_MESSAGE_LEN 24576
#define MAX_RECORD_LENGTH 24576 #define MAX_RECORD_LENGTH 24576

View File

@@ -54,7 +54,7 @@
if(act == "custom") if(act == "custom")
if(!message) if(!message)
message = sanitize_or_reflect(tgui_input_text(src,"Choose an emote to display."), src) //VOREStation Edit - Reflect too long messages, within reason message = sanitize_or_reflect(tgui_input_text(src,"Choose an emote to display.", encode = FALSE), src) //VOREStation Edit - Reflect too long messages, within reason
if(!message) if(!message)
return return
if (!m_type) if (!m_type)

View File

@@ -23,7 +23,7 @@
var/input var/input
if(!message) if(!message)
input = sanitize_or_reflect(tgui_input_text(src, "Choose an emote to display."), src) //VOREStation Edit - Reflect too long messages, within reason input = sanitize_or_reflect(tgui_input_text(src, "Choose an emote to display.", encode = FALSE), src) //VOREStation Edit - Reflect too long messages, within reason
else else
input = message input = message

View File

@@ -448,7 +448,7 @@
if(loc != card) if(loc != card)
to_chat(src, span_warning("Your message won't be visible while unfolded!")) to_chat(src, span_warning("Your message won't be visible while unfolded!"))
if (!message) if (!message)
message = tgui_input_text(src, "Enter text you would like to show on your screen.","Screen Message") message = tgui_input_text(src, "Enter text you would like to show on your screen.","Screen Message", encode = FALSE)
message = sanitize_or_reflect(message,src) message = sanitize_or_reflect(message,src)
if (!message) if (!message)
return return

View File

@@ -476,7 +476,7 @@
to_chat(L, span_warning("You cannot speak in IC (muted).")) to_chat(L, span_warning("You cannot speak in IC (muted)."))
return return
if (!message) if (!message)
message = tgui_input_text(usr, "Type a message to emote.","Emote Beyond") message = tgui_input_text(usr, "Type a message to emote.","Emote Beyond", encode = FALSE)
message = sanitize_or_reflect(message,L) message = sanitize_or_reflect(message,L)
if (!message) if (!message)
return return
@@ -1142,7 +1142,7 @@
to_chat(L, span_warning("You cannot speak in IC (muted).")) to_chat(L, span_warning("You cannot speak in IC (muted)."))
return return
if (!message) if (!message)
message = tgui_input_text(L, "Type a message to emote.","Emote Beyond") message = tgui_input_text(L, "Type a message to emote.","Emote Beyond", encode = FALSE)
message = sanitize_or_reflect(message,L) message = sanitize_or_reflect(message,L)
if (!message) if (!message)
return return

View File

@@ -5,7 +5,7 @@
client?.start_thinking() client?.start_thinking()
client?.start_typing() client?.start_typing()
var/message = tgui_input_text(src, "Speak to people in sight.\nType your message:", "Say") var/message = tgui_input_text(src, "Speak to people in sight.\nType your message:", "Say", encode = FALSE)
client?.stop_thinking() client?.stop_thinking()
if(message) if(message)
@@ -18,7 +18,7 @@
client?.start_thinking() client?.start_thinking()
client?.start_typing() client?.start_typing()
var/message = tgui_input_text(src, "Emote to people in sight (and your pred/prey).\nType your message:", "Emote", multiline = TRUE) var/message = tgui_input_text(src, "Emote to people in sight (and your pred/prey).\nType your message:", "Emote", multiline = TRUE, encode = FALSE)
client?.stop_thinking() client?.stop_thinking()
if(message) if(message)
@@ -28,7 +28,11 @@
set name = "Whisper Old" set name = "Whisper Old"
set category = "IC.Subtle" set category = "IC.Subtle"
var/message = tgui_input_text(src, "Speak to nearby people.\nType your message:", "Whisper") if(client?.prefs?.read_preference(/datum/preference/toggle/show_typing_indicator_subtle))
client?.start_thinking()
client?.start_typing()
var/message = tgui_input_text(src, "Speak to nearby people.\nType your message:", "Whisper", encode = FALSE)
client?.stop_thinking()
if(message) if(message)
whisper(message) whisper(message)
@@ -39,7 +43,11 @@
set category = "IC.Subtle" set category = "IC.Subtle"
set desc = "Emote to nearby people (and your pred/prey)" set desc = "Emote to nearby people (and your pred/prey)"
var/message = tgui_input_text(src, "Emote to nearby people (and your pred/prey).\nType your message:", "Subtle", multiline = TRUE) if(client?.prefs?.read_preference(/datum/preference/toggle/show_typing_indicator_subtle))
client?.start_thinking()
client?.start_typing()
var/message = tgui_input_text(src, "Emote to nearby people (and your pred/prey).\nType your message:", "Subtle", multiline = TRUE, encode = FALSE)
client?.stop_thinking()
if(message) if(message)
me_verb_subtle(message) me_verb_subtle(message)
@@ -49,7 +57,7 @@
set category = "IC.Subtle" set category = "IC.Subtle"
set desc = "Emote to nearby people, with ability to choose which specific portion of people you wish to target." set desc = "Emote to nearby people, with ability to choose which specific portion of people you wish to target."
var/message = tgui_input_text(src, "Emote to nearby people, with ability to choose which specific portion of people you wish to target.\nType your message:", "Subtle (Custom)", multiline = TRUE) var/message = tgui_input_text(src, "Emote to nearby people, with ability to choose which specific portion of people you wish to target.\nType your message:", "Subtle (Custom)", multiline = TRUE, encode = FALSE)
if(message) if(message)
me_verb_subtle_custom(message) me_verb_subtle_custom(message)
@@ -58,7 +66,7 @@
set name = "Psay Old" set name = "Psay Old"
set category = "IC.Subtle" set category = "IC.Subtle"
var/message = tgui_input_text(src, "Talk to people affected by complete absorbed or dominate predator/prey.\nType your message:", "Psay") var/message = tgui_input_text(src, "Talk to people affected by complete absorbed or dominate predator/prey.\nType your message:", "Psay", encode = FALSE)
if(message) if(message)
psay(message) psay(message)
@@ -67,7 +75,7 @@
set name = "Pme Old" set name = "Pme Old"
set category = "IC.Subtle" set category = "IC.Subtle"
var/message = tgui_input_text(src, "Emote to people affected by complete absorbed or dominate predator/prey.\nType your message:", "Pme") var/message = tgui_input_text(src, "Emote to people affected by complete absorbed or dominate predator/prey.\nType your message:", "Pme", encode = FALSE)
if(message) if(message)
pme(message) pme(message)
@@ -76,7 +84,7 @@
set name = "Narrate (Player) Old" set name = "Narrate (Player) Old"
set category = "IC.Chat" set category = "IC.Chat"
var/message = tgui_input_text(src, "Narrate an action or event! An alternative to emoting, for when your emote shouldn't start with your name!\nType your message:", "Narrate (Player)") var/message = tgui_input_text(src, "Narrate an action or event! An alternative to emoting, for when your emote shouldn't start with your name!\nType your message:", "Narrate (Player)", encode = FALSE)
if(message) if(message)
player_narrate(message) player_narrate(message)

View File

@@ -5,7 +5,7 @@
/mob/verb/me_verb_subtle(message as message) //This would normally go in say.dm //CHOMPEdit /mob/verb/me_verb_subtle(message as message) //This would normally go in say.dm //CHOMPEdit
set name = "Subtle" set name = "Subtle"
set desc = "Emote to nearby people (and your pred/prey)" set desc = "Emote to nearby people (and your pred/prey)"
set hidden = 1 set hidden = TRUE
if(forced_psay) if(forced_psay)
pme(message) pme(message)
@@ -69,7 +69,7 @@
var/input var/input
if(!message) if(!message)
input = sanitize_or_reflect(tgui_input_text(src,"Choose an emote to display."), src) input = sanitize_or_reflect(tgui_input_text(src,"Choose an emote to display.", encode = FALSE), src)
else else
input = message input = message
@@ -217,8 +217,6 @@
if(act == "me") if(act == "me")
return custom_emote_vr(type, message, mode_selection) return custom_emote_vr(type, message, mode_selection)
#define MAX_HUGE_MESSAGE_LEN 8192
#define POST_DELIMITER_STR "\<\>"
/proc/sanitize_or_reflect(message,user) /proc/sanitize_or_reflect(message,user)
//Way too long to send //Way too long to send
if(length(message) > MAX_HUGE_MESSAGE_LEN) if(length(message) > MAX_HUGE_MESSAGE_LEN)
@@ -250,8 +248,6 @@
var/posts = CEILING((length/MAX_MESSAGE_LEN), 1) var/posts = CEILING((length/MAX_MESSAGE_LEN), 1)
to_chat(user,message) to_chat(user,message)
to_chat(user, span_danger("^ This message was NOT SENT ^ -- It was [length] characters, and the limit is [MAX_MESSAGE_LEN]. It would fit in [posts] separate messages.")) to_chat(user, span_danger("^ This message was NOT SENT ^ -- It was [length] characters, and the limit is [MAX_MESSAGE_LEN]. It would fit in [posts] separate messages."))
#undef MAX_HUGE_MESSAGE_LEN
#undef POST_DELIMITER_STR
///// PSAY ///// ///// PSAY /////
@@ -264,7 +260,7 @@
to_chat(src, span_warning("You cannot speak in IC (muted).")) to_chat(src, span_warning("You cannot speak in IC (muted)."))
return return
if (!message) if (!message)
message = tgui_input_text(src, "Type a message to say.","Psay") message = tgui_input_text(src, "Type a message to say.","Psay", encode = FALSE)
message = sanitize_or_reflect(message,src) message = sanitize_or_reflect(message,src)
if (!message) if (!message)
return return
@@ -369,7 +365,7 @@
to_chat(src, span_warning("You cannot speak in IC (muted).")) to_chat(src, span_warning("You cannot speak in IC (muted)."))
return return
if (!message) if (!message)
message = tgui_input_text(src, "Type a message to emote.","Pme") message = tgui_input_text(src, "Type a message to emote.","Pme", encode = FALSE)
message = sanitize_or_reflect(message,src) message = sanitize_or_reflect(message,src)
if (!message) if (!message)
return return
@@ -472,7 +468,7 @@
to_chat(src, span_warning("You cannot speak in IC (muted).")) to_chat(src, span_warning("You cannot speak in IC (muted)."))
return return
if(!message) if(!message)
message = tgui_input_text(src, "Type a message to narrate.","Narrate") message = tgui_input_text(src, "Type a message to narrate.","Narrate", encode = FALSE)
message = sanitize_or_reflect(message,src) message = sanitize_or_reflect(message,src)
if(!message) if(!message)
return return

View File

@@ -20,13 +20,7 @@
winset(src, "tgui_say.browser", "focus=true") winset(src, "tgui_say.browser", "focus=true")
return return
client?.start_thinking() say_verb_old()
client?.start_typing()
var/message = tgui_input_text(src, "Type your message:", "Say")
client?.stop_thinking()
if(message)
say_verb(message)
/mob/verb/me_wrapper() /mob/verb/me_wrapper()
set name = "Me verb" set name = "Me verb"
@@ -37,13 +31,7 @@
winset(src, "tgui_say.browser", "focus=true") winset(src, "tgui_say.browser", "focus=true")
return return
client?.start_thinking() me_verb_old()
client?.start_typing()
var/message = tgui_input_text(src, "Type your message:", "Emote", multiline = TRUE)
client?.stop_thinking()
if(message)
me_verb(message)
/mob/verb/whisper_wrapper() /mob/verb/whisper_wrapper()
set name = "Whisper verb" set name = "Whisper verb"
@@ -54,14 +42,7 @@
winset(src, "tgui_say.browser", "focus=true") winset(src, "tgui_say.browser", "focus=true")
return return
if(client?.prefs?.read_preference(/datum/preference/toggle/show_typing_indicator_subtle)) whisper_old()
client?.start_thinking()
client?.start_typing()
var/message = tgui_input_text(src, "Type your message:", "Whisper")
client?.stop_thinking()
if(message)
whisper(message)
/mob/verb/subtle_wrapper() /mob/verb/subtle_wrapper()
set name = "Subtle verb" set name = "Subtle verb"
@@ -73,11 +54,4 @@
winset(src, "tgui_say.browser", "focus=true") winset(src, "tgui_say.browser", "focus=true")
return return
if(client?.prefs?.read_preference(/datum/preference/toggle/show_typing_indicator_subtle)) me_verb_subtle_old()
client?.start_thinking()
client?.start_typing()
var/message = tgui_input_text(src, "Type your message:", "Subtle", multiline = TRUE)
client?.stop_thinking()
if(message)
me_verb_subtle(message)

View File

@@ -124,10 +124,9 @@
/datum/data/pda/app/messenger/proc/create_message(var/mob/living/U, var/obj/item/pda/P) /datum/data/pda/app/messenger/proc/create_message(var/mob/living/U, var/obj/item/pda/P)
var/t = tgui_input_text(U, "Please enter message", name, null) var/t = tgui_input_text(U, "Please enter message", name, null, MAX_MESSAGE_LEN)
if(!t) if(!t)
return return
t = sanitize(copytext(t, 1, MAX_MESSAGE_LEN))
t = readd_quotes(t) t = readd_quotes(t)
if(!t || !istype(P)) if(!t || !istype(P))
return return