summaryrefslogtreecommitdiff
path: root/src/net/eathena/chathandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-02 17:40:59 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-06 01:18:56 +0300
commit148bafe5950332613068f60543e5a1833e661587 (patch)
treecfba3719482da21e9a0f4cff2e1ce2ad23c437e0 /src/net/eathena/chathandler.cpp
parent7976202af5db10450d111d7e204b68bb40c1a489 (diff)
downloadplus-148bafe5950332613068f60543e5a1833e661587.tar.gz
plus-148bafe5950332613068f60543e5a1833e661587.tar.bz2
plus-148bafe5950332613068f60543e5a1833e661587.tar.xz
plus-148bafe5950332613068f60543e5a1833e661587.zip
add packet comments in chathandler.
Diffstat (limited to 'src/net/eathena/chathandler.cpp')
-rw-r--r--src/net/eathena/chathandler.cpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp
index b1ba52cdf..e94bbe874 100644
--- a/src/net/eathena/chathandler.cpp
+++ b/src/net/eathena/chathandler.cpp
@@ -112,24 +112,24 @@ void ChatHandler::talk(const std::string &restrict text,
MessageOut outMsg(CMSG_CHAT_MESSAGE);
// Added + 1 in order to let eAthena parse admin commands correctly
- outMsg.writeInt16(static_cast<int16_t>(mes.length() + 4 + 1));
- outMsg.writeString(mes, static_cast<int>(mes.length() + 1));
+ outMsg.writeInt16(static_cast<int16_t>(mes.length() + 4 + 1), "len");
+ outMsg.writeString(mes, static_cast<int>(mes.length() + 1), "message");
}
void ChatHandler::talkRaw(const std::string &mes) const
{
MessageOut outMsg(CMSG_CHAT_MESSAGE);
- outMsg.writeInt16(static_cast<int16_t>(mes.length() + 4));
- outMsg.writeString(mes, static_cast<int>(mes.length()));
+ outMsg.writeInt16(static_cast<int16_t>(mes.length() + 4), "len");
+ outMsg.writeString(mes, static_cast<int>(mes.length()), "message");
}
void ChatHandler::privateMessage(const std::string &restrict recipient,
const std::string &restrict text)
{
MessageOut outMsg(CMSG_CHAT_WHISPER);
- outMsg.writeInt16(static_cast<int16_t>(text.length() + 28));
- outMsg.writeString(recipient, 24);
- outMsg.writeString(text, static_cast<int>(text.length()));
+ outMsg.writeInt16(static_cast<int16_t>(text.length() + 28), "len");
+ outMsg.writeString(recipient, 24, "recipient nick");
+ outMsg.writeString(text, static_cast<int>(text.length()), "message");
mSentWhispers.push(recipient);
}
@@ -182,11 +182,11 @@ void ChatHandler::processRaw(MessageOut &restrict outMsg,
{
const int i = atoi(line.c_str());
if (line.length() <= 3)
- outMsg.writeInt8(static_cast<unsigned char>(i));
+ outMsg.writeInt8(static_cast<unsigned char>(i), "raw");
else if (line.length() <= 5)
- outMsg.writeInt16(static_cast<int16_t>(i));
+ outMsg.writeInt16(static_cast<int16_t>(i), "raw");
else
- outMsg.writeInt32(i);
+ outMsg.writeInt32(i, "raw");
}
else
{
@@ -211,13 +211,13 @@ void ChatHandler::processRaw(MessageOut &restrict outMsg,
switch (header[0])
{
case '1':
- outMsg.writeInt8(static_cast<unsigned char>(i));
+ outMsg.writeInt8(static_cast<unsigned char>(i), "raw");
break;
case '2':
- outMsg.writeInt16(static_cast<int16_t>(i));
+ outMsg.writeInt16(static_cast<int16_t>(i), "raw");
break;
case '4':
- outMsg.writeInt32(i);
+ outMsg.writeInt32(i, "raw");
break;
case 'c':
{
@@ -235,12 +235,13 @@ void ChatHandler::processRaw(MessageOut &restrict outMsg,
atoi(data.substr(0, pos).c_str()));
const int dir = atoi(data.substr(pos + 1).c_str());
outMsg.writeCoordinates(x, y,
- static_cast<unsigned char>(dir));
+ static_cast<unsigned char>(dir), "raw");
}
break;
}
case 't':
- outMsg.writeString(data, static_cast<int>(data.length()));
+ outMsg.writeString(data,
+ static_cast<int>(data.length()), "raw");
break;
default:
break;
@@ -251,13 +252,13 @@ void ChatHandler::processRaw(MessageOut &restrict outMsg,
void ChatHandler::ignoreAll() const
{
MessageOut outMsg(CMSG_IGNORE_ALL);
- outMsg.writeInt8(0);
+ outMsg.writeInt8(0, "flag");
}
void ChatHandler::unIgnoreAll() const
{
MessageOut outMsg(CMSG_IGNORE_ALL);
- outMsg.writeInt8(1);
+ outMsg.writeInt8(1, "flag");
}
void ChatHandler::processChat(Net::MessageIn &msg)
@@ -278,7 +279,7 @@ void ChatHandler::processChat(Net::MessageIn &msg)
return;
}
- std::string chatMsg = msg.readRawString(chatMsgLength);
+ std::string chatMsg = msg.readRawString(chatMsgLength, "message");
const size_t pos = chatMsg.find(" : ", 0);
if (normalChat)