summaryrefslogtreecommitdiff
path: root/src/net/tmwa/chatrecv.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-11-27 21:51:59 +0300
committerAndrei Karas <akaras@inbox.ru>2018-11-27 21:51:59 +0300
commitd33ffd2ac6230059cce68ecae862d3bdc813b93d (patch)
tree1e30c7373c78c6d968bc9697ad72a71df4d84e46 /src/net/tmwa/chatrecv.cpp
parent2734f4a788dad6faf960d53de00da74ebff69bd5 (diff)
downloadmanaplus-d33ffd2ac6230059cce68ecae862d3bdc813b93d.tar.gz
manaplus-d33ffd2ac6230059cce68ecae862d3bdc813b93d.tar.bz2
manaplus-d33ffd2ac6230059cce68ecae862d3bdc813b93d.tar.xz
manaplus-d33ffd2ac6230059cce68ecae862d3bdc813b93d.zip
Avoid shop spam in legacy server.
Diffstat (limited to 'src/net/tmwa/chatrecv.cpp')
-rw-r--r--src/net/tmwa/chatrecv.cpp17
1 files changed, 17 insertions, 0 deletions
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,