diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-08-25 03:10:19 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-08-25 03:10:19 +0300 |
commit | b68c40d34eecf9da09a00101286b046d93927161 (patch) | |
tree | 3a72009efde8295d85309b77abe1df9b5e9d5ec7 /src/net/eathena/mail2recv.cpp | |
parent | 82e3927dd6a1e7c035cda8c88a1287834367b95f (diff) | |
download | plus-b68c40d34eecf9da09a00101286b046d93927161.tar.gz plus-b68c40d34eecf9da09a00101286b046d93927161.tar.bz2 plus-b68c40d34eecf9da09a00101286b046d93927161.tar.xz plus-b68c40d34eecf9da09a00101286b046d93927161.zip |
Add support for show mail list for new mail system.
Diffstat (limited to 'src/net/eathena/mail2recv.cpp')
-rw-r--r-- | src/net/eathena/mail2recv.cpp | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/net/eathena/mail2recv.cpp b/src/net/eathena/mail2recv.cpp index 3b6b7ed1a..eb4c8d6b6 100644 --- a/src/net/eathena/mail2recv.cpp +++ b/src/net/eathena/mail2recv.cpp @@ -32,6 +32,8 @@ #include "enums/resources/notifytypes.h" +#include "gui/mailmessage.h" + #include "gui/windows/maileditwindow.h" #include "gui/windows/mailwindow.h" @@ -50,6 +52,7 @@ #include "utils/checkutils.h" #include "utils/gettext.h" +#include "utils/stringutils.h" #include "debug.h" @@ -279,20 +282,28 @@ void Mail2Recv::processSendResult(Net::MessageIn &msg) void Mail2Recv::processMailListPage(Net::MessageIn &msg) { - UNIMPLEMENTEDPACKET; + if (mailWindow == nullptr) + { + reportAlways("mail window not created"); + return; + } msg.readInt16("len"); - msg.readUInt8("open type"); + mailWindow->setOpenType(fromInt(msg.readUInt8("open type"), + MailOpenTypeT)); const int cnt = msg.readUInt8("cnt"); msg.readUInt8("isEnd"); for (int f = 0; f < cnt; f ++) { - msg.readInt64("mail id"); - msg.readUInt8("is read"); - msg.readUInt8("type"); - msg.readString(24, "sender name"); - msg.readInt32("reg time"); - msg.readInt32("expire time"); - msg.readString(-1, "title"); + MailMessage *const mail = new MailMessage; + mail->id = msg.readInt64("mail id"); + mail->read = msg.readUInt8("is read") != 0U ? true : false; + mail->type = msg.readUInt8("type"); + mail->sender = msg.readString(24, "sender name"); + mail->time = msg.readInt32("reg time"); + mail->strTime = timeToStr(mail->time); + mail->expireTime = msg.readInt32("expire time"); + mail->title = msg.readString(-1, "title"); + mailWindow->addMail(mail); } } |