summaryrefslogtreecommitdiff
path: root/src/net/eathena/chathandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-04-05 20:22:00 +0300
committerAndrei Karas <akaras@inbox.ru>2015-04-05 20:22:00 +0300
commitbd44e8d0a94dd96e6f8eb0828b4f2b5de902ee83 (patch)
tree28bfbcce0f7f34db5a42c7a27dfdac3a75b80e14 /src/net/eathena/chathandler.cpp
parent84b6217136c8d59347ab9f28ec5e9e4d718d5058 (diff)
downloadmv-bd44e8d0a94dd96e6f8eb0828b4f2b5de902ee83.tar.gz
mv-bd44e8d0a94dd96e6f8eb0828b4f2b5de902ee83.tar.bz2
mv-bd44e8d0a94dd96e6f8eb0828b4f2b5de902ee83.tar.xz
mv-bd44e8d0a94dd96e6f8eb0828b4f2b5de902ee83.zip
add chat command for join chat room.
New chat command: /joinroom NAME
Diffstat (limited to 'src/net/eathena/chathandler.cpp')
-rw-r--r--src/net/eathena/chathandler.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp
index eb7dfe375..77e87df71 100644
--- a/src/net/eathena/chathandler.cpp
+++ b/src/net/eathena/chathandler.cpp
@@ -661,6 +661,7 @@ void ChatHandler::processChatDisplay(Net::MessageIn &msg)
obj->currentUsers = msg.readInt16("current users");
obj->type = msg.readUInt8("type");
obj->title = msg.readString(len, "title");
+ obj->update();
Being *const dstBeing = actorManager->findBeing(obj->ownerId);
if (dstBeing)
@@ -680,14 +681,31 @@ void ChatHandler::joinChat(const ChatObject *const chat,
void ChatHandler::processChatRoomJoinAck(Net::MessageIn &msg)
{
- UNIMPLIMENTEDPACKET;
- const int count = msg.readInt16("len") - 8;
- msg.readInt32("chat id");
+ const int count = (msg.readInt16("len") - 8) / 28;
+ const int id = msg.readInt32("chat id");
+
+ // +++ ignore chat members for now
for (int f = 0; f < count; f ++)
{
msg.readInt32("role");
msg.readString(24, "name");
}
+
+ ChatObject *oldChat = ChatObject::findById(id);
+ if (!oldChat)
+ oldChat = new ChatObject;
+
+ PlayerInfo::setRoomName(oldChat->title);
+ chatWindow->joinRoom(true);
+ ChatObject *const obj = new ChatObject;
+ obj->ownerId = oldChat->ownerId;
+ obj->chatId = oldChat->chatId;
+ obj->maxUsers = oldChat->maxUsers;
+ obj->currentUsers = oldChat->currentUsers;
+ obj->type = oldChat->type;
+ obj->title = oldChat->title;
+ obj->update();
+ localPlayer->setChat(obj);
}
void ChatHandler::processChatRoomLeave(Net::MessageIn &msg)
@@ -863,6 +881,7 @@ void ChatHandler::processChatRoomCreateAck(Net::MessageIn &msg)
obj->currentUsers = 1;
obj->type = 1;
obj->title = mChatRoom;
+ obj->update();
localPlayer->setChat(obj);
break;
}