Nice Commit! :)

This commit is contained in:
TomNordesen
2021-12-07 19:58:24 +01:00
parent fe5814d5ba
commit bfcce19649
3 changed files with 9 additions and 2 deletions

View File

@@ -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;
}