From a7f5cb51379d7e2062c4732cd00bf975319987d3 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 3 Nov 2013 12:22:27 +0300 Subject: fix motd message show/hide on "new" tmw server. --- src/net/ea/chathandler.cpp | 14 ++++++++++++-- src/net/ea/chathandler.h | 3 ++- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'src/net/ea') 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 -- cgit v1.2.3-70-g09d2