mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-19 03:45:43 +00:00
feat(Core/Chat): new argument parsing and unify chat hyperlink parsing (#6243)
This commit is contained in:
@@ -304,20 +304,6 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
||||
SendNotification(GetAcoreString(LANG_WAIT_BEFORE_SPEAKING), timeStr.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (lang != LANG_ADDON)
|
||||
{
|
||||
if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) && !ChatHandler(this).isValidChatMessage(msg.c_str()))
|
||||
{
|
||||
//LOG_ERROR("network.opcode", "Player %s (%s) sent a chatmessage with an invalid link: %s", GetPlayer()->GetName().c_str(),
|
||||
// GetPlayer()->GetGUID().ToString().c_str(), msg.c_str());
|
||||
|
||||
if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK))
|
||||
KickPlayer("CONFIG_CHAT_STRICT_LINK_CHECKING_KICK");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// do message validity checks
|
||||
@@ -352,29 +338,14 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
||||
auto end = std::unique(msg.begin(), msg.end(), [](char c1, char c2) { return (c1 == ' ') && (c2 == ' '); });
|
||||
msg.erase(end, msg.end());
|
||||
}
|
||||
}
|
||||
|
||||
// exploit
|
||||
size_t found1 = msg.find("|Hquest");
|
||||
if (found1 != std::string::npos)
|
||||
{
|
||||
size_t found2 = msg.find(":", found1 + 8);
|
||||
size_t found3 = msg.find("|", found1 + 8);
|
||||
if (found3 != std::string::npos)
|
||||
// Validate hyperlinks
|
||||
if (!ValidateHyperlinksAndMaybeKick(msg))
|
||||
{
|
||||
if (found2 == std::string::npos)
|
||||
return;
|
||||
if (found2 > found3)
|
||||
return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// prevent crash player
|
||||
if (msg.find("| |Hquest") != std::string::npos)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
sScriptMgr->OnBeforeSendChatMessage(_player, type, lang, msg);
|
||||
|
||||
switch (type)
|
||||
|
||||
Reference in New Issue
Block a user