Exempts non-deadminned admins from all the chat filters so they can break the server rules and get banned if they want to. (#62944)

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
This commit is contained in:
Timberpoes
2021-11-20 07:18:11 +00:00
committed by GitHub
parent 0fff80ad27
commit 1152f4f15a
6 changed files with 16 additions and 10 deletions

View File

@@ -7,3 +7,6 @@
/// Given a chat filter result, will send a to_chat to the user telling them about why their message was blocked
#define REPORT_CHAT_FILTER_TO_USER(user, filter_result) \
to_chat(user, span_warning("The word <b>[html_encode(filter_result[CHAT_FILTER_INDEX_WORD])]</b> is prohibited: [html_encode(filter_result[CHAT_FILTER_INDEX_REASON])]"))
/// Given a user, returns TRUE if they are allowed to bypass the filter.
#define CAN_BYPASS_FILTER(user) (!isnull(user?.client?.holder))

View File

@@ -766,12 +766,12 @@ GLOBAL_LIST_EMPTY(PDAs)
if((last_text && world.time < last_text + 10) || (everyone && last_everyone && world.time < last_everyone + PDA_SPAM_DELAY))
return FALSE
var/list/filter_result = is_ic_filtered_for_pdas(message)
var/list/filter_result = CAN_BYPASS_FILTER(user) ? null : is_ic_filtered_for_pdas(message)
if (filter_result)
REPORT_CHAT_FILTER_TO_USER(user, filter_result)
return FALSE
var/list/soft_filter_result = is_soft_ic_filtered_for_pdas(message)
var/list/soft_filter_result = CAN_BYPASS_FILTER(user) ? null : is_soft_ic_filtered_for_pdas(message)
if (soft_filter_result)
if(tgui_alert(usr,"Your message contains \"[soft_filter_result[CHAT_FILTER_INDEX_WORD]]\". \"[soft_filter_result[CHAT_FILTER_INDEX_REASON]]\", Are you sure you want to send it?", "Soft Blocked Word", list("Yes", "No")) != "Yes")
return FALSE

View File

@@ -21,12 +21,12 @@
if(!input || !IsAvailable())
return
var/list/filter_result = is_ic_filtered(input)
var/list/filter_result = CAN_BYPASS_FILTER(usr) ? null : is_ic_filtered(input)
if(filter_result)
REPORT_CHAT_FILTER_TO_USER(usr, filter_result)
return
var/list/soft_filter_result = is_soft_ic_filtered(input)
var/list/soft_filter_result = CAN_BYPASS_FILTER(usr) ? null : is_soft_ic_filtered(input)
if(soft_filter_result)
if(tgui_alert(usr,"Your message contains \"[soft_filter_result[CHAT_FILTER_INDEX_WORD]]\". \"[soft_filter_result[CHAT_FILTER_INDEX_REASON]]\", Are you sure you want to say it?", "Soft Blocked Word", list("Yes", "No")) != "Yes")
return

View File

@@ -32,11 +32,14 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
var/raw_msg = msg
var/list/filter_result = is_ooc_filtered(msg)
if (filter_result)
if (!CAN_BYPASS_FILTER(usr) && filter_result)
REPORT_CHAT_FILTER_TO_USER(usr, filter_result)
return
var/list/soft_filter_result = is_soft_ooc_filtered(msg)
// Protect filter bypassers from themselves.
// Demote hard filter results to soft filter results if necessary due to the danger of accidentally speaking in OOC.
var/list/soft_filter_result = filter_result || is_soft_ooc_filtered(msg)
if (soft_filter_result)
if(tgui_alert(usr,"Your message contains \"[soft_filter_result[CHAT_FILTER_INDEX_WORD]]\". \"[soft_filter_result[CHAT_FILTER_INDEX_REASON]]\", Are you sure you want to say it?", "Soft Blocked Word", list("Yes", "No")) != "Yes")
return

View File

@@ -12,12 +12,12 @@
/mob/dead/observer/say(message, bubble_type, list/spans = list(), sanitize = TRUE, datum/language/language = null, ignore_spam = FALSE, forced = null, filterproof = null)
message = trim(message) //trim now and sanitize after checking for special admin radio keys
var/list/filter_result = is_ooc_filtered(message)
var/list/filter_result = CAN_BYPASS_FILTER(src) ? null : is_ooc_filtered(message)
if (filter_result)
REPORT_CHAT_FILTER_TO_USER(usr, filter_result)
return
var/list/soft_filter_result = is_soft_ooc_filtered(message)
var/list/soft_filter_result = CAN_BYPASS_FILTER(src) ? null : is_soft_ooc_filtered(message)
if (soft_filter_result)
if(tgui_alert(usr,"Your message contains \"[soft_filter_result[CHAT_FILTER_INDEX_WORD]]\". \"[soft_filter_result[CHAT_FILTER_INDEX_REASON]]\", Are you sure you want to say it?", "Soft Blocked Word", list("Yes", "No")) != "Yes")
return

View File

@@ -97,9 +97,9 @@ GLOBAL_LIST_INIT(message_modes_stat_limits, list(
var/list/soft_filter_result
if(client && !forced && !filterproof)
//The filter doesn't act on the sanitized message, but the raw message.
filter_result = is_ic_filtered(message)
filter_result = CAN_BYPASS_FILTER(src) ? null : is_ic_filtered(message)
if(!filter_result)
soft_filter_result = is_soft_ic_filtered(message)
soft_filter_result = CAN_BYPASS_FILTER(src) ? null : is_soft_ic_filtered(message)
if(sanitize)
message = trim(copytext_char(sanitize(message), 1, MAX_MESSAGE_LEN))