summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-12-15 20:56:12 +0300
committerAndrei Karas <akaras@inbox.ru>2013-12-15 20:56:12 +0300
commitd0cdad7bf81a07ba4b2f13c73a65fe1c68bb702f (patch)
tree94a41847e96e9a06f92efdfcc4880e5b8551c8ce /src
parent18b6055c46e828f621192e6c9fa7ab6a6b1d99aa (diff)
downloadmv-d0cdad7bf81a07ba4b2f13c73a65fe1c68bb702f.tar.gz
mv-d0cdad7bf81a07ba4b2f13c73a65fe1c68bb702f.tar.bz2
mv-d0cdad7bf81a07ba4b2f13c73a65fe1c68bb702f.tar.xz
mv-d0cdad7bf81a07ba4b2f13c73a65fe1c68bb702f.zip
fix multiline motd messages showing/hiding.
Diffstat (limited to 'src')
-rw-r--r--src/net/ea/chathandler.cpp9
-rw-r--r--src/net/ea/chathandler.h1
2 files changed, 7 insertions, 3 deletions
diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp
index 7199d3b5c..a10bf931d 100644
--- a/src/net/ea/chathandler.cpp
+++ b/src/net/ea/chathandler.cpp
@@ -49,6 +49,7 @@ namespace Ea
ChatHandler::ChatHandler() :
mSentWhispers(),
+ mMotdTime(-1),
mShowAllLang(serverConfig.getValue("showAllLang", 0)),
mShowMotd(config.getBoolValue("showmotd")),
mSkipping(true)
@@ -367,15 +368,17 @@ void ChatHandler::processChat(Net::MessageIn &msg, const bool normalChat,
}
}
- if (chatMsg.find(": ") == std::string::npos && !mShowMotd
+ if (pos == std::string::npos && !mShowMotd
&& mSkipping && channel.empty())
{
// skip motd from "new" tmw server
+ if (mMotdTime == -1)
+ mMotdTime = cur_time + 1;
+ else if (mMotdTime == cur_time || mMotdTime < cur_time)
+ mSkipping = false;
return;
}
- mSkipping = false;
-
if (pos != std::string::npos)
chatMsg.erase(0, pos + 3);
diff --git a/src/net/ea/chathandler.h b/src/net/ea/chathandler.h
index 49909ad6f..ead5dac98 100644
--- a/src/net/ea/chathandler.h
+++ b/src/net/ea/chathandler.h
@@ -60,6 +60,7 @@ class ChatHandler : public Net::ChatHandler
protected:
typedef std::queue<std::string> WhisperQueue;
WhisperQueue mSentWhispers;
+ int mMotdTime;
bool mShowAllLang;
bool mShowMotd;
bool mSkipping;