diff options
| author | Treeston <treeston.mmoc@gmail.com> | 2018-09-18 01:28:57 +0200 |
|---|---|---|
| committer | Treeston <treeston.mmoc@gmail.com> | 2018-09-18 01:28:57 +0200 |
| commit | e858706270c3059acf6915e7cf655eed0f7e88bb (patch) | |
| tree | d70fc5041fff18dee36e03fb93bc72a0142af9e6 /src/server/game/Server | |
| parent | d1a6546ff78d273d1759f9af5a2d26424739710c (diff) | |
Core/Chat: Some hyperlink follow-ups:
* Ignore messages containing invalid links again instead of trying to sanitize them. Closes #22451.
* No longer filter messages on the addon channel. Closes #22450.
Diffstat (limited to 'src/server/game/Server')
| -rw-r--r-- | src/server/game/Server/WorldSession.cpp | 15 | ||||
| -rw-r--r-- | src/server/game/Server/WorldSession.h | 4 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 9b2ce6fe4a9..e49ee044dd8 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -32,6 +32,7 @@ #include "Group.h" #include "Guild.h" #include "GuildMgr.h" +#include "Hyperlinks.h" #include "Log.h" #include "Map.h" #include "Metric.h" @@ -591,6 +592,20 @@ void WorldSession::KickPlayer() } } +bool WorldSession::ValidateHyperlinksAndMaybeKick(std::string const& str) +{ + if (Trinity::Hyperlinks::CheckAllLinks(str)) + return true; + + TC_LOG_ERROR("network", "Player %s (GUID: %u) sent a message with an invalid link:\n%s", GetPlayer()->GetName().c_str(), + GetPlayer()->GetGUID().GetCounter(), str.c_str()); + + if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK)) + KickPlayer(); + + return false; +} + void WorldSession::SendNotification(const char *format, ...) { if (format) diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 03e80c7e69e..540bc239128 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -30,6 +30,7 @@ #include "Packet.h" #include "QueryCallbackProcessor.h" #include "SharedDefines.h" +#include <string> #include <unordered_map> class BigNumber; @@ -335,6 +336,9 @@ class TC_GAME_API WorldSession void LogoutPlayer(bool save); void KickPlayer(); + // Returns true if all contained hyperlinks are valid + // May kick player on false depending on world config (handler should abort) + bool ValidateHyperlinksAndMaybeKick(std::string const& str); void QueuePacket(WorldPacket* new_packet); bool Update(uint32 diff, PacketFilter& updater); |
