diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-04-29 21:36:44 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-04-29 21:36:44 +0300 |
commit | 600c370ed33ec9828ef609d68a8e46d564f0f1af (patch) | |
tree | 21b6ee1a0250dfa123858a53bfe991cba33af01a /src/gui/windows | |
parent | 8e0bbcbabb8752d8c28618e98a1ea46309252f3a (diff) | |
download | plus-600c370ed33ec9828ef609d68a8e46d564f0f1af.tar.gz plus-600c370ed33ec9828ef609d68a8e46d564f0f1af.tar.bz2 plus-600c370ed33ec9828ef609d68a8e46d564f0f1af.tar.xz plus-600c370ed33ec9828ef609d68a8e46d564f0f1af.zip |
eathena: impliment packet SMSG_MAIL_RETURN.
Diffstat (limited to 'src/gui/windows')
-rw-r--r-- | src/gui/windows/mailwindow.cpp | 31 | ||||
-rw-r--r-- | src/gui/windows/mailwindow.h | 2 |
2 files changed, 33 insertions, 0 deletions
diff --git a/src/gui/windows/mailwindow.cpp b/src/gui/windows/mailwindow.cpp index 15faf779a..ecef7b54e 100644 --- a/src/gui/windows/mailwindow.cpp +++ b/src/gui/windows/mailwindow.cpp @@ -164,6 +164,37 @@ void MailWindow::addMail(MailMessage *const message) mMessagesMap[message->id] = message; } +void MailWindow::removeMail(const int id) +{ + std::map<int, MailMessage*>::iterator it1 = mMessagesMap.find(id); + if (it1 != mMessagesMap.end()) + mMessagesMap.erase(it1); + + mMailModel->clear(); + + FOR_EACH (std::vector<MailMessage*>::iterator, it, mMessages) + { + MailMessage *message = *it; + if (message && message->id == id) + { + mMessages.erase(it); + delete message; + break; + } + } + + FOR_EACH (std::vector<MailMessage*>::iterator, it, mMessages) + { + MailMessage *message = *it; + if (message) + { + mMailModel->add(strprintf("%s %s", + message->unread ? " " : "U", + message->title.c_str())); + } + } +} + void MailWindow::showMessage(MailMessage *const mail) { if (!mail) diff --git a/src/gui/windows/mailwindow.h b/src/gui/windows/mailwindow.h index 15964aafe..23f89be0a 100644 --- a/src/gui/windows/mailwindow.h +++ b/src/gui/windows/mailwindow.h @@ -56,6 +56,8 @@ class MailWindow final : public Window, void showMessage(MailMessage *const mail); + void removeMail(const int id); + private: std::vector<MailMessage*> mMessages; std::map<int, MailMessage*> mMessagesMap; |