summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
};