summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-11-03 12:22:27 +0300
committerAndrei Karas <akaras@inbox.ru>2013-11-03 12:22:27 +0300
commita7f5cb51379d7e2062c4732cd00bf975319987d3 (patch)
treef38d4a772612cf7d7cc33a478a96e9dd911efeb1
parentbd7821e9648186abf1fa06c6ded9e61755b1d369 (diff)
downloadmanaplus-a7f5cb51379d7e2062c4732cd00bf975319987d3.tar.gz
manaplus-a7f5cb51379d7e2062c4732cd00bf975319987d3.tar.bz2
manaplus-a7f5cb51379d7e2062c4732cd00bf975319987d3.tar.xz
manaplus-a7f5cb51379d7e2062c4732cd00bf975319987d3.zip
fix motd message show/hide on "new" tmw server.
-rw-r--r--src/net/ea/chathandler.cpp14
-rw-r--r--src/net/ea/chathandler.h3
2 files changed, 14 insertions, 3 deletions
diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp
index deaef6984..0c34291c4 100644
--- a/src/net/ea/chathandler.cpp
+++ b/src/net/ea/chathandler.cpp
@@ -48,7 +48,8 @@ namespace Ea
ChatHandler::ChatHandler() :
mSentWhispers(),
mShowAllLang(serverConfig.getValue("showAllLang", 0)),
- mShowMotd(config.getBoolValue("showmotd"))
+ mShowMotd(config.getBoolValue("showmotd")),
+ mSkipping(true)
{
}
@@ -311,7 +312,7 @@ void ChatHandler::processBeingChat(Net::MessageIn &msg,
}
void ChatHandler::processChat(Net::MessageIn &msg, const bool normalChat,
- const bool channels) const
+ const bool channels)
{
BLOCK_START("ChatHandler::processChat")
int chatMsgLength = msg.readInt16() - 4;
@@ -334,6 +335,15 @@ void ChatHandler::processChat(Net::MessageIn &msg, const bool normalChat,
if (normalChat)
{
+ if (chatMsg.find(": ") == std::string::npos && !mShowMotd
+ && mSkipping && channel.empty())
+ {
+ // skip motd from "new" tmw server
+ return;
+ }
+
+ mSkipping = true;
+
if (chatWindow)
{
chatWindow->resortChatLog(chatMsg, BY_PLAYER,
diff --git a/src/net/ea/chathandler.h b/src/net/ea/chathandler.h
index 3f0e054a5..5ceccc0c2 100644
--- a/src/net/ea/chathandler.h
+++ b/src/net/ea/chathandler.h
@@ -49,7 +49,7 @@ class ChatHandler : public Net::ChatHandler
const bool channels) const;
virtual void processChat(Net::MessageIn &msg, const bool normalChat,
- const bool channels) const;
+ const bool channels);
virtual void processMVP(Net::MessageIn &msg) const;
@@ -60,6 +60,7 @@ class ChatHandler : public Net::ChatHandler
WhisperQueue mSentWhispers;
bool mShowAllLang;
bool mShowMotd;
+ bool mSkipping;
};
} // namespace Ea