summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-04-05 21:40:58 +0300
committerAndrei Karas <akaras@inbox.ru>2015-04-06 01:56:15 +0300
commitb956661094109ae89ea87550cec5a9a6ed9eaa90 (patch)
treeeb08269175d0ab08d16d1884e713578c4a71bf24
parentcb847e9e671f6d65f177686ae8544525c8f53763 (diff)
downloadmanaplus-b956661094109ae89ea87550cec5a9a6ed9eaa90.tar.gz
manaplus-b956661094109ae89ea87550cec5a9a6ed9eaa90.tar.bz2
manaplus-b956661094109ae89ea87550cec5a9a6ed9eaa90.tar.xz
manaplus-b956661094109ae89ea87550cec5a9a6ed9eaa90.zip
eathena: impliment packet SMSG_CHAT_ROOM_LEAVE.
-rw-r--r--src/net/eathena/chathandler.cpp32
-rw-r--r--src/resources/notifications.h8
-rw-r--r--src/resources/notifytypes.h2
3 files changed, 39 insertions, 3 deletions
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)
diff --git a/src/resources/notifications.h b/src/resources/notifications.h
index 132409fd0..8249fef28 100644
--- a/src/resources/notifications.h
+++ b/src/resources/notifications.h
@@ -523,6 +523,14 @@ namespace NotifyManager
// TRANSLATORS: notification message
N_("%s joined room."),
NotifyFlags::STRING},
+ {"chat room leave",
+ // TRANSLATORS: notification message
+ N_("%s left room."),
+ NotifyFlags::STRING},
+ {"chat room kick",
+ // TRANSLATORS: notification message
+ N_("%s kicked from room."),
+ NotifyFlags::STRING},
};
} // namespace NotifyManager
#endif // RESOURCES_NOTIFICATIONS_H
diff --git a/src/resources/notifytypes.h b/src/resources/notifytypes.h
index 972e694a9..d8d10b8a3 100644
--- a/src/resources/notifytypes.h
+++ b/src/resources/notifytypes.h
@@ -149,6 +149,8 @@ namespace NotifyTypes
ROOM_LIMIT_EXCEEDED,
ROOM_ALREADY_EXISTS,
ROOM_JOINED,
+ ROOM_LEAVE,
+ ROOM_KICKED,
TYPE_END
};