Updated profanity manager to only redact in 'public' channels

This commit is contained in:
Uleat 2019-02-05 21:06:37 -05:00
parent b810e3aa71
commit e908958eb8
2 changed files with 30 additions and 7 deletions

View File

@ -1,6 +1,9 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50) EQEMu Changelog (Started on Sept 24, 2003 15:50)
------------------------------------------------------- -------------------------------------------------------
== 2/5/2019 ==
Uleat: Updated profanity manager to only redact in 'public' channels
== 2/4/2019 == == 2/4/2019 ==
Uleat: Added command 'profanity' (aliased 'prof') Uleat: Added command 'profanity' (aliased 'prof')
- This is a server-based tool for redacting any language that an admin deems as profanity (socially unacceptable within their community) - This is a server-based tool for redacting any language that an admin deems as profanity (socially unacceptable within their community)

View File

@ -896,10 +896,6 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
language = 0; // No need for language when drunk language = 0; // No need for language when drunk
} }
// Censor the message
if (EQEmu::ProfanityManager::IsCensorshipActive() && (chan_num != 8))
EQEmu::ProfanityManager::RedactMessage(message);
switch(chan_num) switch(chan_num)
{ {
case 0: { /* Guild Chat */ case 0: { /* Guild Chat */
@ -936,6 +932,9 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
if (GetPet() && GetTarget() == GetPet() && GetPet()->FindType(SE_VoiceGraft)) if (GetPet() && GetTarget() == GetPet() && GetPet()->FindType(SE_VoiceGraft))
sender = GetPet(); sender = GetPet();
if (EQEmu::ProfanityManager::IsCensorshipActive())
EQEmu::ProfanityManager::RedactMessage(message);
entity_list.ChannelMessage(sender, chan_num, language, lang_skill, message); entity_list.ChannelMessage(sender, chan_num, language, lang_skill, message);
break; break;
} }
@ -965,16 +964,22 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
} }
} }
if (EQEmu::ProfanityManager::IsCensorshipActive())
EQEmu::ProfanityManager::RedactMessage(message);
if (!worldserver.SendChannelMessage(this, 0, 4, 0, language, message)) if (!worldserver.SendChannelMessage(this, 0, 4, 0, language, message))
Message(0, "Error: World server disconnected"); Message(0, "Error: World server disconnected");
} }
else if(!RuleB(Chat, ServerWideAuction)) { else if(!RuleB(Chat, ServerWideAuction)) {
Mob *sender = this; Mob *sender = this;
if (GetPet() && GetTarget() == GetPet() && GetPet()->FindType(SE_VoiceGraft)) if (GetPet() && GetTarget() == GetPet() && GetPet()->FindType(SE_VoiceGraft))
sender = GetPet(); sender = GetPet();
entity_list.ChannelMessage(sender, chan_num, language, message); if (EQEmu::ProfanityManager::IsCensorshipActive())
EQEmu::ProfanityManager::RedactMessage(message);
entity_list.ChannelMessage(sender, chan_num, language, message);
} }
break; break;
} }
@ -1009,6 +1014,9 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
} }
} }
if (EQEmu::ProfanityManager::IsCensorshipActive())
EQEmu::ProfanityManager::RedactMessage(message);
if (!worldserver.SendChannelMessage(this, 0, 5, 0, language, message)) if (!worldserver.SendChannelMessage(this, 0, 5, 0, language, message))
{ {
Message(0, "Error: World server disconnected"); Message(0, "Error: World server disconnected");
@ -1021,12 +1029,16 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
if (GetPet() && GetTarget() == GetPet() && GetPet()->FindType(SE_VoiceGraft)) if (GetPet() && GetTarget() == GetPet() && GetPet()->FindType(SE_VoiceGraft))
sender = GetPet(); sender = GetPet();
if (EQEmu::ProfanityManager::IsCensorshipActive())
EQEmu::ProfanityManager::RedactMessage(message);
entity_list.ChannelMessage(sender, chan_num, language, message); entity_list.ChannelMessage(sender, chan_num, language, message);
} }
break; break;
} }
case 6: /* Broadcast */ case 6: /* Broadcast */
case 11: { /* GM Say */ case 11: { /* GM Say */
// gms/admins should have enough tact to not abuse their own servers...
if (!(admin >= 80)) if (!(admin >= 80))
Message(0, "Error: Only GMs can use this channel"); Message(0, "Error: Only GMs can use this channel");
else if (!worldserver.SendChannelMessage(this, targetname, chan_num, 0, language, message)) else if (!worldserver.SendChannelMessage(this, targetname, chan_num, 0, language, message))
@ -1159,6 +1171,11 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
} }
case 20: case 20:
{ {
// need to activate ucs filter for non-private channels - do not redact here
//if (EQEmu::ProfanityManager::IsCensorshipActive())
// EQEmu::ProfanityManager::RedactMessage(message);
// UCS Relay for Underfoot and later. // UCS Relay for Underfoot and later.
if(!worldserver.SendChannelMessage(this, 0, chan_num, 0, language, message)) if(!worldserver.SendChannelMessage(this, 0, chan_num, 0, language, message))
Message(0, "Error: World server disconnected"); Message(0, "Error: World server disconnected");
@ -1173,6 +1190,9 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
if (msg_len > 512) if (msg_len > 512)
message[512] = '\0'; message[512] = '\0';
if (EQEmu::ProfanityManager::IsCensorshipActive())
EQEmu::ProfanityManager::RedactMessage(message);
auto outapp = new EQApplicationPacket(OP_Emote, 4 + msg_len + strlen(GetName()) + 2); auto outapp = new EQApplicationPacket(OP_Emote, 4 + msg_len + strlen(GetName()) + 2);
Emote_Struct* es = (Emote_Struct*)outapp->pBuffer; Emote_Struct* es = (Emote_Struct*)outapp->pBuffer;
char *Buffer = (char *)es; char *Buffer = (char *)es;