mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
feat(mail): notify online recipients of new mail on any world
Mail sent to someone who is not in the sender's world (system mail with no address, and all player-to-player mail) now reaches them: the world sends a MailNotify (Chat::MAIL, unused until now) to the chat server, which passes it to the world the receiver is in, and that world sends the client its unread count with a NewMail NotificationResponse. Receivers in the same world are told directly. Player-to-player mail did not notify the receiver at all before. Replaces the TODO in Mail::SendMail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -269,6 +269,14 @@ namespace {
|
||||
handlers.On<FindPlayerRequest>(Chat::WHO, ChatPacketHandler::HandleWho);
|
||||
handlers.On<ShowAllRequest>(Chat::SHOW_ALL, ChatPacketHandler::HandleShowAll);
|
||||
handlers.On<AchievementNotify>(Chat::ACHIEVEMENT_NOTIFY, ChatPacketHandler::OnAchievementNotify);
|
||||
// New mail: pass it on to the world the receiver is in, if they are online
|
||||
handlers.On<MailNotify>(Chat::MAIL, [](const MailNotify& notify, const SystemAddress&) {
|
||||
const auto& receiver = Game::playerContainer.GetPlayerData(notify.receiverID);
|
||||
if (!receiver) return;
|
||||
RakNet::BitStream bitStream;
|
||||
notify.WritePacket(bitStream);
|
||||
Game::server->Send(bitStream, receiver.worldServerSysAddr, false);
|
||||
});
|
||||
return handlers;
|
||||
}();
|
||||
return handlers;
|
||||
|
||||
Reference in New Issue
Block a user