From bfcce196491f629c00c1a5afc5ea546ca1dff218 Mon Sep 17 00:00:00 2001 From: TomNordesen Date: Tue, 7 Dec 2021 19:58:24 +0100 Subject: [PATCH] Nice Commit! :) --- dChatFilter/dChatFilter.cpp | 8 +++++++- dNet/ClientPackets.cpp | 1 + dWorldServer/WorldServer.cpp | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dChatFilter/dChatFilter.cpp b/dChatFilter/dChatFilter.cpp index 70bd2e45..f03e5583 100644 --- a/dChatFilter/dChatFilter.cpp +++ b/dChatFilter/dChatFilter.cpp @@ -110,16 +110,22 @@ bool dChatFilter::IsSentenceOkay(const std::string& message, int gmLevel) { segment = std::regex_replace(segment, reg, ""); size_t hash = CalculateHash(segment); + Game::logger->Log("SEGMENT", "Word: %s Hash: %zu", segment.c_str(), hash); if (std::find(m_UserUnapprovedWordCache.begin(), m_UserUnapprovedWordCache.end(), hash) != m_UserUnapprovedWordCache.end()) { + Game::logger->Log("SENTENCEOKAY", "SENTENCE IS UNNAPROVED"); return false; } - if (!IsInWordlist(hash)) { + bool a = IsInWordlist(hash); + Game::logger->Log("ISWORDLIST", "ISINWORDLIST: %s", a?"YES":"NO"); + if (!a) { + Game::logger->Log("SENTENCEOKAY", "SENTENCE IS NOT IN WORDLIST"); m_UserUnapprovedWordCache.push_back(hash); return false; } } + Game::logger->Log("SENTENCEOKAY", "SENTENCE IS OKAY TO SEND"); return true; } diff --git a/dNet/ClientPackets.cpp b/dNet/ClientPackets.cpp index 566120f6..2da9629e 100644 --- a/dNet/ClientPackets.cpp +++ b/dNet/ClientPackets.cpp @@ -295,6 +295,7 @@ void ClientPackets::HandleChatModerationRequest(const SystemAddress& sysAddr, Pa std::unordered_map unacceptedItems; bool bAllClean = Game::chatFilter->IsSentenceOkay(message, user->GetLastUsedChar()->GetGMLevel()); + Game::logger->Log("BALLCLEAN", "%s", bAllClean?"Is Clean":"IS NOT CLEAN!!!"); if (!bAllClean) { unacceptedItems.insert(std::make_pair((char)0, (char)message.length())); } diff --git a/dWorldServer/WorldServer.cpp b/dWorldServer/WorldServer.cpp index 54633cff..5d155f29 100644 --- a/dWorldServer/WorldServer.cpp +++ b/dWorldServer/WorldServer.cpp @@ -833,7 +833,7 @@ void HandlePacket(Packet* packet) { } if (packet->data[1] != WORLD) return; - + switch (packet->data[3]) { case MSG_WORLD_CLIENT_VALIDATION: { std::string username = PacketUtils::ReadString(0x08, packet, true);