diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-10-15 19:10:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-10-18 16:21:43 +0300 |
commit | ebcf64c0ab592793bae3a9f77b5d87e912e0c2f6 (patch) | |
tree | f084eed06eb5a0c9b612e9bd48ddeffa13935b0b /src/net/eathena/mail2recv.cpp | |
parent | 8107a607f05176000630e73424cb14beae55a6f8 (diff) | |
download | manaverse-ebcf64c0ab592793bae3a9f77b5d87e912e0c2f6.tar.gz manaverse-ebcf64c0ab592793bae3a9f77b5d87e912e0c2f6.tar.bz2 manaverse-ebcf64c0ab592793bae3a9f77b5d87e912e0c2f6.tar.xz manaverse-ebcf64c0ab592793bae3a9f77b5d87e912e0c2f6.zip |
Add packet SMSG_MAIL2_MAIL_LIST_PAGE 0x0ac2.
Diffstat (limited to 'src/net/eathena/mail2recv.cpp')
-rw-r--r-- | src/net/eathena/mail2recv.cpp | 61 |
1 files changed, 45 insertions, 16 deletions
diff --git a/src/net/eathena/mail2recv.cpp b/src/net/eathena/mail2recv.cpp index 1afb69d16..09208d94b 100644 --- a/src/net/eathena/mail2recv.cpp +++ b/src/net/eathena/mail2recv.cpp @@ -52,6 +52,8 @@ #include "debug.h" +extern int packetVersion; + namespace EAthena { @@ -334,24 +336,51 @@ void Mail2Recv::processMailListPage(Net::MessageIn &msg) return; } msg.readInt16("len"); - mailWindow->setOpenType(fromInt(msg.readUInt8("open type"), - MailOpenTypeT)); - const int cnt = msg.readUInt8("cnt"); - const bool isEnd = msg.readUInt8("isEnd") != 0; - for (int f = 0; f < cnt; f ++) + bool isEnd = true; + if (packetVersion < 20170419) { - MailMessage *const mail = new MailMessage; - mail->id = msg.readInt64("mail id"); - mail->read = msg.readUInt8("is read") != 0U ? true : false; - mail->type = static_cast<MailMessageType::Type>( - msg.readUInt8("type")); - mail->sender = msg.readString(24, "sender name"); - mail->time = CAST_S32(cur_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); + mailWindow->setOpenType(fromInt(msg.readUInt8("open type"), + MailOpenTypeT)); + const int cnt = msg.readUInt8("cnt"); + isEnd = msg.readUInt8("isEnd") != 0; + for (int f = 0; f < cnt; f ++) + { + MailMessage *const mail = new MailMessage; + mail->id = msg.readInt64("mail id"); + mail->read = msg.readUInt8("is read") != 0U ? true : false; + mail->type = static_cast<MailMessageType::Type>( + msg.readUInt8("type")); + mail->sender = msg.readString(24, "sender name"); + if (packetVersion < 20170419) + { + mail->time = CAST_S32(cur_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); + } } + else + { + isEnd = msg.readUInt8("isEnd") != 0; + while (msg.getUnreadLength() > 0) + { + MailMessage *const mail = new MailMessage; + // +++ need save open type into MailMessage + msg.readUInt8("open type"); + mail->id = msg.readInt64("mail id"); + mail->read = msg.readUInt8("is read") != 0U ? true : false; + mail->type = static_cast<MailMessageType::Type>( + msg.readUInt8("type")); + mail->sender = msg.readString(24, "sender name"); + mail->strTime = "-"; + mail->expireTime = msg.readInt32("expire time"); + mail->title = msg.readString(-1, "title"); + mailWindow->addMail(mail); + } + } + if (isEnd) mailWindow->setLastPage(); } |