summaryrefslogtreecommitdiff
path: root/src/net/eathena
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-03-27 21:45:16 +0300
committerAndrei Karas <akaras@inbox.ru>2013-03-27 21:45:16 +0300
commit0fe0f8bae7b754453e6e6bb7c7b29903facb9311 (patch)
treed92c810fbc93fe8bb2f362a7ef023ebe96653c2d /src/net/eathena
parent8150191686759b13a239c25970924c3c186140ff (diff)
downloadmv-0fe0f8bae7b754453e6e6bb7c7b29903facb9311.tar.gz
mv-0fe0f8bae7b754453e6e6bb7c7b29903facb9311.tar.bz2
mv-0fe0f8bae7b754453e6e6bb7c7b29903facb9311.tar.xz
mv-0fe0f8bae7b754453e6e6bb7c7b29903facb9311.zip
improve chathandler class.
Diffstat (limited to 'src/net/eathena')
-rw-r--r--src/net/eathena/chathandler.cpp16
-rw-r--r--src/net/eathena/chathandler.h15
2 files changed, 16 insertions, 15 deletions
diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp
index 55941e030..9ec9fe621 100644
--- a/src/net/eathena/chathandler.cpp
+++ b/src/net/eathena/chathandler.cpp
@@ -102,12 +102,12 @@ void ChatHandler::handleMessage(Net::MessageIn &msg)
}
void ChatHandler::talk(const std::string &text,
- const std::string &channel A_UNUSED)
+ const std::string &channel A_UNUSED) 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);
MessageOut outMsg(CMSG_CHAT_MESSAGE);
@@ -116,7 +116,7 @@ void ChatHandler::talk(const std::string &text,
outMsg.writeString(mes, static_cast<int>(mes.length() + 1));
}
-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
@@ -134,12 +134,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;
@@ -190,7 +190,7 @@ void ChatHandler::processRaw(MessageOut &outMsg, const std::string &line)
}
else
{
- std::string header = line.substr(0, pos);
+ const std::string header = line.substr(0, pos);
std::string data = line.substr(pos + 1);
if (header.length() != 1)
return;
@@ -248,13 +248,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);
diff --git a/src/net/eathena/chathandler.h b/src/net/eathena/chathandler.h
index 928b7aeb0..737b3269c 100644
--- a/src/net/eathena/chathandler.h
+++ b/src/net/eathena/chathandler.h
@@ -42,22 +42,23 @@ class ChatHandler final : public MessageHandler, public Ea::ChatHandler
void handleMessage(Net::MessageIn &msg);
- void talk(const std::string &text, const std::string &channel);
+ void talk(const std::string &text,
+ const std::string &channel) const;
- void talkRaw(const std::string &text);
+ void talkRaw(const std::string &text) const;
void privateMessage(const std::string &recipient,
const std::string &text);
- void who();
+ void who() const;
- void sendRaw(const std::string &args);
+ void sendRaw(const std::string &args) const;
- void ignoreAll();
+ void ignoreAll() const;
- void unIgnoreAll();
+ void unIgnoreAll() const;
- void processRaw(MessageOut &outMsg, const std::string &line);
+ static void processRaw(MessageOut &outMsg, const std::string &line);
};
} // namespace EAthena