diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-10-17 15:54:03 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-10-17 15:54:03 +0300 |
commit | 879615bf93c0a4159ca68a1fc07657370c79950d (patch) | |
tree | 779fe86cf943a953997c67c31b11c92df26f2900 | |
parent | c4802097dec05ca39e395e7dba3a55dba70edbe8 (diff) | |
download | manaplus-879615bf93c0a4159ca68a1fc07657370c79950d.tar.gz manaplus-879615bf93c0a4159ca68a1fc07657370c79950d.tar.bz2 manaplus-879615bf93c0a4159ca68a1fc07657370c79950d.tar.xz manaplus-879615bf93c0a4159ca68a1fc07657370c79950d.zip |
Add static in chathandler.
-rw-r--r-- | src/net/ea/chathandler.cpp | 27 | ||||
-rw-r--r-- | src/net/ea/chathandler.h | 29 | ||||
-rw-r--r-- | src/net/eathena/chathandler.cpp | 2 | ||||
-rw-r--r-- | src/net/eathena/chathandler.h | 29 | ||||
-rw-r--r-- | src/net/tmwa/chathandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/chathandler.h | 14 |
6 files changed, 56 insertions, 47 deletions
diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp index 4e5d2300b..4fe3cae63 100644 --- a/src/net/ea/chathandler.cpp +++ b/src/net/ea/chathandler.cpp @@ -51,13 +51,20 @@ namespace Ea { -ChatHandler::ChatHandler() : - mSentWhispers(), - mMotdTime(-1), - mShowAllLang(serverConfig.getValue("showAllLang", 0)), - mShowMotd(config.getBoolValue("showmotd")), - mSkipping(true) +WhisperQueue ChatHandler::mSentWhispers; +int ChatHandler::mMotdTime = -1; +bool ChatHandler::mShowAllLang = false; +bool ChatHandler::mShowMotd = false; +bool ChatHandler::mSkipping = true; + +ChatHandler::ChatHandler() { + if (!mSentWhispers.empty()) + mSentWhispers.pop(); + mMotdTime = -1; + mShowAllLang = serverConfig.getValue("showAllLang", 0); + mShowMotd = config.getBoolValue("showmotd"); + mSkipping = true; } void ChatHandler::clear() @@ -157,7 +164,7 @@ void ChatHandler::processWhisperResponseContinue(const uint8_t type) } void ChatHandler::processWhisperContinue(const std::string &nick, - std::string chatMsg) const + std::string chatMsg) { // ignoring future whisper messages if (chatMsg.find("\302\202G") == 0 || chatMsg.find("\302\202A") == 0) @@ -277,7 +284,7 @@ void ChatHandler::processWhisperContinue(const std::string &nick, BLOCK_END("ChatHandler::processWhisper") } -void ChatHandler::processBeingChat(Net::MessageIn &msg) const +void ChatHandler::processBeingChat(Net::MessageIn &msg) { if (!actorManager) return; @@ -356,7 +363,7 @@ void ChatHandler::processBeingChat(Net::MessageIn &msg) const BLOCK_END("ChatHandler::processBeingChat") } -void ChatHandler::processMVP(Net::MessageIn &msg) const +void ChatHandler::processMVP(Net::MessageIn &msg) { BLOCK_START("ChatHandler::processMVP") // Display MVP player @@ -372,7 +379,7 @@ void ChatHandler::processMVP(Net::MessageIn &msg) const BLOCK_END("ChatHandler::processMVP") } -void ChatHandler::processIgnoreAllResponse(Net::MessageIn &msg) const +void ChatHandler::processIgnoreAllResponse(Net::MessageIn &msg) { BLOCK_START("ChatHandler::processIgnoreAllResponse") const uint8_t action = msg.readUInt8("action"); diff --git a/src/net/ea/chathandler.h b/src/net/ea/chathandler.h index 80cf6afbb..5555aa7a3 100644 --- a/src/net/ea/chathandler.h +++ b/src/net/ea/chathandler.h @@ -35,6 +35,8 @@ namespace Net namespace Ea { +typedef std::queue<std::string> WhisperQueue; + class ChatHandler notfinal : public Net::ChatHandler { public: @@ -48,30 +50,29 @@ class ChatHandler notfinal : public Net::ChatHandler void me(const std::string &restrict text, const std::string &restrict channel) const override final; - virtual void processBeingChat(Net::MessageIn &msg) const; + static void processBeingChat(Net::MessageIn &msg); - virtual void processMVP(Net::MessageIn &msg) const; + static void processMVP(Net::MessageIn &msg); - virtual void processIgnoreAllResponse(Net::MessageIn &msg) const; + static void processIgnoreAllResponse(Net::MessageIn &msg); void clear() override final; - void processWhisperContinue(const std::string &nick, - std::string chatMsg) const; + static void processWhisperContinue(const std::string &nick, + std::string chatMsg); - void processWhisperResponseContinue(const uint8_t type); + static void processWhisperResponseContinue(const uint8_t type); protected: - std::string getPopLastWhisperNick(); + static std::string getPopLastWhisperNick(); - std::string getLastWhisperNick(); + static std::string getLastWhisperNick(); - typedef std::queue<std::string> WhisperQueue; - WhisperQueue mSentWhispers; - int mMotdTime; - bool mShowAllLang; - bool mShowMotd; - bool mSkipping; + static WhisperQueue mSentWhispers; + static int mMotdTime; + static bool mShowAllLang; + static bool mShowMotd; + static bool mSkipping; }; } // namespace Ea diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp index d16692cf5..950363350 100644 --- a/src/net/eathena/chathandler.cpp +++ b/src/net/eathena/chathandler.cpp @@ -481,7 +481,7 @@ void ChatHandler::processGmChat2(Net::MessageIn &msg) chatWindow->addGlobalMessage(chatMsg); } -void ChatHandler::processWhisper(Net::MessageIn &msg) const +void ChatHandler::processWhisper(Net::MessageIn &msg) { BLOCK_START("ChatHandler::processWhisper") const int chatMsgLength = msg.readInt16("len") - 32; diff --git a/src/net/eathena/chathandler.h b/src/net/eathena/chathandler.h index 6bcf315bd..c48d74470 100644 --- a/src/net/eathena/chathandler.h +++ b/src/net/eathena/chathandler.h @@ -85,33 +85,34 @@ class ChatHandler final : public MessageHandler, public Ea::ChatHandler protected: static std::string extractChannelFromMessage(std::string &chatMsg); - void processChat(Net::MessageIn &msg); + static void processChat(Net::MessageIn &msg); - void processColorChat(Net::MessageIn &msg); + static void processColorChat(Net::MessageIn &msg); - void processChatContinue(std::string chatMsg, ChatMsgType::Type own); + static void processChatContinue(std::string chatMsg, + ChatMsgType::Type own); - void processWhisper(Net::MessageIn &msg) const; + static void processWhisper(Net::MessageIn &msg); - void processWhisperResponse(Net::MessageIn &msg); + static void processWhisperResponse(Net::MessageIn &msg); - void processGmChat(Net::MessageIn &msg); + static void processGmChat(Net::MessageIn &msg); - void processGmChat2(Net::MessageIn &msg); + static void processGmChat2(Net::MessageIn &msg); - void processChatIgnoreList(Net::MessageIn &msg); + static void processChatIgnoreList(Net::MessageIn &msg); - void processFormatMessage(Net::MessageIn &msg); + static void processFormatMessage(Net::MessageIn &msg); - void processFormatMessageNumber(Net::MessageIn &msg); + static void processFormatMessageNumber(Net::MessageIn &msg); - void processFormatMessageSkill(Net::MessageIn &msg); + static void processFormatMessageSkill(Net::MessageIn &msg); - void processChatDisplay(Net::MessageIn &msg); + static void processChatDisplay(Net::MessageIn &msg); - void processChatJoinAck(Net::MessageIn &msg); + static void processChatJoinAck(Net::MessageIn &msg); - void processChatLeave(Net::MessageIn &msg); + static void processChatLeave(Net::MessageIn &msg); }; } // namespace EAthena diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index b2f14e027..c55089cbc 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -434,7 +434,7 @@ void ChatHandler::processGmChat(Net::MessageIn &msg) BLOCK_END("ChatHandler::processChat") } -void ChatHandler::processWhisper(Net::MessageIn &msg) const +void ChatHandler::processWhisper(Net::MessageIn &msg) { BLOCK_START("ChatHandler::processWhisper") const int chatMsgLength = msg.readInt16("len") - 28; diff --git a/src/net/tmwa/chathandler.h b/src/net/tmwa/chathandler.h index 791ad11f3..80effa23e 100644 --- a/src/net/tmwa/chathandler.h +++ b/src/net/tmwa/chathandler.h @@ -81,18 +81,18 @@ class ChatHandler final : public MessageHandler, public Ea::ChatHandler const std::string &password) const override final; protected: - void processChat(Net::MessageIn &msg); + static void processChat(Net::MessageIn &msg); - void processChat2(Net::MessageIn &msg); + static void processChat2(Net::MessageIn &msg); - void processChatContinue(std::string chatMsg, - const std::string &channel); + static void processChatContinue(std::string chatMsg, + const std::string &channel); - void processGmChat(Net::MessageIn &msg); + static void processGmChat(Net::MessageIn &msg); - void processWhisper(Net::MessageIn &msg) const; + static void processWhisper(Net::MessageIn &msg); - void processWhisperResponse(Net::MessageIn &msg); + static void processWhisperResponse(Net::MessageIn &msg); }; } // namespace TmwAthena |