diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-03-27 21:45:16 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-03-27 21:45:16 +0300 |
commit | 0fe0f8bae7b754453e6e6bb7c7b29903facb9311 (patch) | |
tree | d92c810fbc93fe8bb2f362a7ef023ebe96653c2d /src/net/tmwa/chathandler.cpp | |
parent | 8150191686759b13a239c25970924c3c186140ff (diff) | |
download | mv-0fe0f8bae7b754453e6e6bb7c7b29903facb9311.tar.gz mv-0fe0f8bae7b754453e6e6bb7c7b29903facb9311.tar.bz2 mv-0fe0f8bae7b754453e6e6bb7c7b29903facb9311.tar.xz mv-0fe0f8bae7b754453e6e6bb7c7b29903facb9311.zip |
improve chathandler class.
Diffstat (limited to 'src/net/tmwa/chathandler.cpp')
-rw-r--r-- | src/net/tmwa/chathandler.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index b04d1604c..655a6d826 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -115,12 +115,13 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) BLOCK_END("ChatHandler::handleMessage") } -void ChatHandler::talk(const std::string &text, const std::string &channel) +void ChatHandler::talk(const std::string &text, + const std::string &channel) const { if (!player_node) return; - std::string mes = std::string(player_node->getName()).append( + const std::string mes = std::string(player_node->getName()).append( " : ").append(text); if (serverVersion >= 8 && channel.size() == 3) @@ -142,7 +143,7 @@ void ChatHandler::talk(const std::string &text, const std::string &channel) } } -void ChatHandler::talkRaw(const std::string &mes) +void ChatHandler::talkRaw(const std::string &mes) const { MessageOut outMsg(CMSG_CHAT_MESSAGE); // Added + 1 in order to let eAthena parse admin commands correctly @@ -160,12 +161,12 @@ void ChatHandler::privateMessage(const std::string &recipient, mSentWhispers.push(recipient); } -void ChatHandler::who() +void ChatHandler::who() const { MessageOut outMsg(CMSG_WHO_REQUEST); } -void ChatHandler::sendRaw(const std::string &args) +void ChatHandler::sendRaw(const std::string &args) const { std::string line = args; std::string str; @@ -216,11 +217,10 @@ void ChatHandler::processRaw(MessageOut &outMsg, const std::string &line) } else { - std::string header = line.substr(0, pos); - std::string data = line.substr(pos + 1); + const std::string header = line.substr(0, pos); if (header.length() != 1) return; - + std::string data = line.substr(pos + 1); int i = 0; switch (header[0]) @@ -274,13 +274,13 @@ void ChatHandler::processRaw(MessageOut &outMsg, const std::string &line) } } -void ChatHandler::ignoreAll() +void ChatHandler::ignoreAll() const { MessageOut outMsg(CMSG_IGNORE_ALL); outMsg.writeInt8(0); } -void ChatHandler::unIgnoreAll() +void ChatHandler::unIgnoreAll() const { MessageOut outMsg(CMSG_IGNORE_ALL); outMsg.writeInt8(1); |