This repository has been archived by the owner on May 27, 2024. It is now read-only.
forked from NovaSector/NovaSector
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIRROR] Change the word filter configuration to allow providing reas…
…ons, fix emotes not working in filters, and implement separate OOC/IC/PDA filters (#8406) * Change the word filter configuration to allow providing reasons, fix emotes not working in filters, and implement separate OOC/IC/PDA filters (#61606) * Change the word filter configuration to allow providing reasons, fix emotes not working in filters, and implement separate OOC/IC/PDA filters Co-authored-by: Mothblocks <[email protected]>
- Loading branch information
1 parent
5d1dc99
commit 357150d
Showing
20 changed files
with
269 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/// The index of the word that was filtered in a is_*_filtered proc | ||
#define CHAT_FILTER_INDEX_WORD 1 | ||
|
||
/// The index of the reason why a word was filtered in a is_*_filtered proc | ||
#define CHAT_FILTER_INDEX_REASON 2 | ||
|
||
/// 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])]")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// [2] is the group index of the blocked term when it is not using word bounds. | ||
// This is sanity checked by unit tests. | ||
#define GET_MATCHED_GROUP(regex) (regex.group[2] || regex.match) | ||
|
||
/// Given a text, will return what word is on the IC filter, with the reason. | ||
/// Returns null if the message is OK. | ||
/proc/is_ic_filtered(message) | ||
if (config.ic_filter_regex?.Find(message)) | ||
var/matched_group = GET_MATCHED_GROUP(config.ic_filter_regex) | ||
return list( | ||
matched_group, | ||
config.ic_filter_reasons[matched_group] || config.ic_outside_pda_filter_reasons[matched_group] || config.shared_filter_reasons[matched_group], | ||
) | ||
|
||
return null | ||
|
||
/// Given a text, will return what word is on the IC filter, ignoring words allowed on the PDA, with the reason. | ||
/// Returns null if the message is OK. | ||
/proc/is_ic_filtered_for_pdas(message) | ||
if (config.ic_outside_pda_filter_regex?.Find(message)) | ||
var/matched_group = GET_MATCHED_GROUP(config.ic_outside_pda_filter_regex) | ||
return list( | ||
matched_group, | ||
config.ic_filter_reasons[matched_group] || config.shared_filter_reasons[matched_group], | ||
) | ||
|
||
return null | ||
|
||
/// Given a text, will return what word is on the OOC filter, with the reason. | ||
/// Returns null if the message is OK. | ||
/proc/is_ooc_filtered(message) | ||
if (config.ooc_filter_regex?.Find(message)) | ||
var/matched_group = GET_MATCHED_GROUP(config.ooc_filter_regex) | ||
return list(matched_group, config.shared_filter_reasons[matched_group]) | ||
|
||
return null | ||
|
||
#undef GET_MATCHED_GROUP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.