mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-22 05:27:19 +00:00
Nice Commit! :)
This commit is contained in:
parent
fe5814d5ba
commit
bfcce19649
@ -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;
|
||||
}
|
||||
|
@ -295,6 +295,7 @@ void ClientPackets::HandleChatModerationRequest(const SystemAddress& sysAddr, Pa
|
||||
|
||||
std::unordered_map<char, char> 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()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user