summaryrefslogtreecommitdiff
path: root/src/gui/windows/mailwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-04-29 21:36:44 +0300
committerAndrei Karas <akaras@inbox.ru>2015-04-29 21:36:44 +0300
commit600c370ed33ec9828ef609d68a8e46d564f0f1af (patch)
tree21b6ee1a0250dfa123858a53bfe991cba33af01a /src/gui/windows/mailwindow.cpp
parent8e0bbcbabb8752d8c28618e98a1ea46309252f3a (diff)
downloadmv-600c370ed33ec9828ef609d68a8e46d564f0f1af.tar.gz
mv-600c370ed33ec9828ef609d68a8e46d564f0f1af.tar.bz2
mv-600c370ed33ec9828ef609d68a8e46d564f0f1af.tar.xz
mv-600c370ed33ec9828ef609d68a8e46d564f0f1af.zip
eathena: impliment packet SMSG_MAIL_RETURN.
Diffstat (limited to 'src/gui/windows/mailwindow.cpp')
-rw-r--r--src/gui/windows/mailwindow.cpp31
1 files changed, 31 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)