diff options
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/eathena/mail2recv.cpp | 29 | ||||
-rw-r--r-- | src/net/eathena/mailrecv.cpp | 2 |
2 files changed, 21 insertions, 10 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); } } diff --git a/src/net/eathena/mailrecv.cpp b/src/net/eathena/mailrecv.cpp index c098b6857..93a548c69 100644 --- a/src/net/eathena/mailrecv.cpp +++ b/src/net/eathena/mailrecv.cpp @@ -79,7 +79,7 @@ void MailRecv::processMailList(Net::MessageIn &msg) MailMessage *const mail = new MailMessage; mail->id = msg.readInt32("message id"); mail->title = msg.readString(40, "title"); - mail->unread = msg.readUInt8("unread flag") != 0u ? true : false; + mail->read = msg.readUInt8("unread flag") != 0u ? true : false; mail->sender = msg.readString(24, "sender name"); mail->time = msg.readInt32("time stamp"); mail->strTime = timeToStr(mail->time); |