From 11e63a9fe8496302dc789c74b2b6ba39a14b568a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 30 Apr 2015 13:00:48 +0300 Subject: Impliment packet SMSG_MAIL_NEW_MAIL. --- src/net/eathena/mailhandler.cpp | 10 ++++++---- src/resources/notifications.h | 4 ++++ src/resources/notifytypes.h | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/net/eathena/mailhandler.cpp b/src/net/eathena/mailhandler.cpp index 040828e9b..68a3a2e67 100644 --- a/src/net/eathena/mailhandler.cpp +++ b/src/net/eathena/mailhandler.cpp @@ -34,6 +34,7 @@ #include "resources/notifytypes.h" +#include "utils/gettext.h" #include "utils/stringutils.h" #include "debug.h" @@ -209,11 +210,12 @@ void MailHandler::processSendMailAck(Net::MessageIn &msg) void MailHandler::processNewMail(Net::MessageIn &msg) { - UNIMPLIMENTEDPACKET; - msg.readInt32("message id"); - msg.readString(40, "title"); - msg.readString(24, "sender name"); + const std::string subj = msg.readString(40, "title"); + const std::string sender = msg.readString(24, "sender name"); + NotifyManager::notify(NotifyTypes::NEW_MAIL, + strprintf(_("You have new mail from %s with subject %s"), + sender.c_str(), subj.c_str())); } void MailHandler::processSetAttachmentAck(Net::MessageIn &msg) diff --git a/src/resources/notifications.h b/src/resources/notifications.h index 81199fcc7..69cb6a205 100644 --- a/src/resources/notifications.h +++ b/src/resources/notifications.h @@ -611,6 +611,10 @@ namespace NotifyManager // TRANSLATORS: notification message N_("Can't get attach. Too many items."), NotifyFlags::EMPTY}, + {"new mail", + // TRANSLATORS: notification message + "%s", + NotifyFlags::STRING}, }; } // namespace NotifyManager #endif // RESOURCES_NOTIFICATIONS_H diff --git a/src/resources/notifytypes.h b/src/resources/notifytypes.h index 14eedf9eb..1c132e876 100644 --- a/src/resources/notifytypes.h +++ b/src/resources/notifytypes.h @@ -171,6 +171,7 @@ namespace NotifyTypes MAIL_GET_ATTACH_OK, MAIL_GET_ATTACH_ERROR, MAIL_GET_ATTACH_TOO_MANY_ITEMS, + NEW_MAIL, TYPE_END }; -- cgit v1.2.3-70-g09d2