From b956661094109ae89ea87550cec5a9a6ed9eaa90 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 5 Apr 2015 21:40:58 +0300 Subject: eathena: impliment packet SMSG_CHAT_ROOM_LEAVE. --- src/net/eathena/chathandler.cpp | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'src/net/eathena/chathandler.cpp') diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp index 3038628ab..f4dd9c937 100644 --- a/src/net/eathena/chathandler.cpp +++ b/src/net/eathena/chathandler.cpp @@ -710,10 +710,36 @@ void ChatHandler::processChatRoomJoinAck(Net::MessageIn &msg) void ChatHandler::processChatRoomLeave(Net::MessageIn &msg) { - UNIMPLIMENTEDPACKET; msg.readInt16("users"); - msg.readString(24, "name"); - msg.readUInt8("flag"); // 0 - left, 1 - kicked + const std::string name = msg.readString(24, "name"); + const int status = msg.readUInt8("flag"); // 0 - left, 1 - kicked + switch(status) + { + case 0: + NotifyManager::notify(NotifyTypes::ROOM_LEAVE, name); + break; + case 1: + NotifyManager::notify(NotifyTypes::ROOM_KICKED, name); + break; + default: + UNIMPLIMENTEDPACKET; + break; + } + if (name == localPlayer->getName()) + { + if (chatWindow) + chatWindow->joinRoom(false); + PlayerInfo::setRoomName(std::string()); + if (localPlayer) + localPlayer->setChat(nullptr); + } + else + { + Being *const being = actorManager->findBeingByName( + name, ActorType::Player); + if (being) + being->setChat(nullptr); + } } void ChatHandler::joinChannel(const std::string &channel) -- cgit v1.2.3-70-g09d2