summaryrefslogtreecommitdiff
path: root/src/net/ea/chathandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-03-20 13:41:18 +0300
committerAndrei Karas <akaras@inbox.ru>2013-03-22 00:08:12 +0300
commit5a8b8f4ad56914e1c75acd29807897ba1433c96f (patch)
tree4e29e8fee3e794ba4b69e383d3f0e12e6e8d62e0 /src/net/ea/chathandler.cpp
parent54ee7d240a8ab3a328d0f3f06f3b9627d4727c90 (diff)
downloadmanaplus-5a8b8f4ad56914e1c75acd29807897ba1433c96f.tar.gz
manaplus-5a8b8f4ad56914e1c75acd29807897ba1433c96f.tar.bz2
manaplus-5a8b8f4ad56914e1c75acd29807897ba1433c96f.tar.xz
manaplus-5a8b8f4ad56914e1c75acd29807897ba1433c96f.zip
add netcode support for channels (for now evol only).
for now any channel ignored and used as general tab. also change netcode version to 8.
Diffstat (limited to 'src/net/ea/chathandler.cpp')
-rw-r--r--src/net/ea/chathandler.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp
index 7be94ca3e..3a2c6ec2e 100644
--- a/src/net/ea/chathandler.cpp
+++ b/src/net/ea/chathandler.cpp
@@ -258,15 +258,25 @@ void ChatHandler::processWhisper(Net::MessageIn &msg)
}
}
-void ChatHandler::processBeingChat(Net::MessageIn &msg)
+void ChatHandler::processBeingChat(Net::MessageIn &msg, const bool channels)
{
if (!actorSpriteManager)
return;
- const int chatMsgLength = msg.readInt16() - 8;
+ int chatMsgLength = msg.readInt16() - 8;
Being *const being = actorSpriteManager->findBeing(msg.readInt32());
+ if (!being)
+ return;
+
+ if (channels)
+ {
+ chatMsgLength -= 3;
+ msg.readInt8(); // channel
+ msg.readInt8(); // channel
+ msg.readInt8(); // channel
+ }
- if (!being || chatMsgLength <= 0)
+ if (chatMsgLength <= 0)
return;
std::string chatMsg = msg.readRawString(chatMsgLength);
@@ -307,10 +317,17 @@ void ChatHandler::processBeingChat(Net::MessageIn &msg)
}
}
-void ChatHandler::processChat(Net::MessageIn &msg, bool normalChat)
+void ChatHandler::processChat(Net::MessageIn &msg, bool normalChat,
+ bool channels)
{
- const int chatMsgLength = msg.readInt16() - 4;
-
+ int chatMsgLength = msg.readInt16() - 4;
+ if (channels)
+ {
+ chatMsgLength -= 3;
+ msg.readInt8(); // channel
+ msg.readInt8(); // channel
+ msg.readInt8(); // channel
+ }
if (chatMsgLength <= 0)
return;