summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-04-27 18:20:50 +0300
committerAndrei Karas <akaras@inbox.ru>2015-04-27 19:55:54 +0300
commit9af27292809ee8bf42f46e214c21c305c3cd810f (patch)
tree99a6ba2d4943932742255ba05eba1a0a94305754 /src/net
parent22ba86a17c2a7ce05cad3cdd1713081a6ea1b2fe (diff)
downloadplus-9af27292809ee8bf42f46e214c21c305c3cd810f.tar.gz
plus-9af27292809ee8bf42f46e214c21c305c3cd810f.tar.bz2
plus-9af27292809ee8bf42f46e214c21c305c3cd810f.tar.xz
plus-9af27292809ee8bf42f46e214c21c305c3cd810f.zip
eathena: impliment packet SMSG_MAIL_MAILS_LIST.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/eathena/mailhandler.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/net/eathena/mailhandler.cpp b/src/net/eathena/mailhandler.cpp
index c8fdff4b2..7d7e128ce 100644
--- a/src/net/eathena/mailhandler.cpp
+++ b/src/net/eathena/mailhandler.cpp
@@ -22,6 +22,10 @@
#include "logger.h"
+#include "gui/mailmessage.h"
+
+#include "gui/windows/mailwindow.h"
+
#include "net/ea/eaprotocol.h"
#include "net/eathena/messageout.h"
@@ -119,19 +123,20 @@ void MailHandler::processMailOpen(Net::MessageIn &msg)
void MailHandler::processMailList(Net::MessageIn &msg)
{
- UNIMPLIMENTEDPACKET;
-
const int count = (msg.readInt16("len") - 8) / 73;
const int amount = msg.readInt32("amount");
if (count != amount)
logger->log("error: wrong mails count");
+ mailWindow->clear();
for (int f = 0; f < count; f ++)
{
- msg.readInt32("message id");
- msg.readString(40, "title");
- msg.readUInt8("unread flag");
- msg.readString(24, "sender name");
- msg.readInt32("time stamp");
+ MailMessage *const mail = new MailMessage;
+ mail->id = msg.readInt32("message id");
+ mail->title = msg.readString(40, "title");
+ mail->unread = msg.readUInt8("unread flag") ? true : false;
+ mail->sender = msg.readString(24, "sender name");
+ mail->time = msg.readInt32("time stamp");
+ mailWindow->addMail(mail);
}
}