From d33ffd2ac6230059cce68ecae862d3bdc813b93d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 27 Nov 2018 21:51:59 +0300 Subject: Avoid shop spam in legacy server. --- src/net/tmwa/chatrecv.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/net/tmwa/chatrecv.cpp') diff --git a/src/net/tmwa/chatrecv.cpp b/src/net/tmwa/chatrecv.cpp index e044d5877..b9dd73af5 100644 --- a/src/net/tmwa/chatrecv.cpp +++ b/src/net/tmwa/chatrecv.cpp @@ -44,11 +44,18 @@ #include "net/tmwa/guildmanager.h" +#include "utils/gettext.h" + #include "debug.h" namespace TmwAthena { +namespace ChatRecv +{ + std::string mShopRequestName; +} // namespace ChatRecv + void ChatRecv::processChat(Net::MessageIn &msg) { BLOCK_START("ChatRecv::processChat") @@ -248,6 +255,16 @@ void ChatRecv::processWhisperContinue(const std::string &nick, && chatMsg.find("\302\202") == 0) { chatMsg = chatMsg.erase(0, 2); + if (mShopRequestName != nick) + { + debugMsg(strprintf( + // TRANSLATORS: message about spam player + _("Detected spam from: %s"), + nick.c_str())); + BLOCK_END("ChatRecv::processWhisper") + return; + } + mShopRequestName.clear(); if (showMsg && chatWindow != nullptr) { chatWindow->addWhisper(nick, -- cgit v1.2.3-60-g2f50