summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-08-26 00:24:45 +0300
committerAndrei Karas <akaras@inbox.ru>2017-08-26 00:24:45 +0300
commita0e63acd1443caa477ac5f7954557a17949c3675 (patch)
tree560c07d6147da181911f934e520b0acc48f68996
parent4f75520b908b11f48c566c7bf0c10f6be5ab74bf (diff)
downloadplus-a0e63acd1443caa477ac5f7954557a17949c3675.tar.gz
plus-a0e63acd1443caa477ac5f7954557a17949c3675.tar.bz2
plus-a0e63acd1443caa477ac5f7954557a17949c3675.tar.xz
plus-a0e63acd1443caa477ac5f7954557a17949c3675.zip
Close mail edit window on success send.
Also show mail send error messages.
-rw-r--r--src/enums/resources/notifytypes.h4
-rw-r--r--src/gui/windows/maileditwindow.cpp1
-rw-r--r--src/net/eathena/mail2recv.cpp26
-rw-r--r--src/resources/notifications.h16
4 files changed, 45 insertions, 2 deletions
diff --git a/src/enums/resources/notifytypes.h b/src/enums/resources/notifytypes.h
index b38fe9d07..643aaf2d1 100644
--- a/src/enums/resources/notifytypes.h
+++ b/src/enums/resources/notifytypes.h
@@ -240,6 +240,10 @@ namespace NotifyTypes
MAIL_ATTACH_ITEM_NOT_TRADEABLE,
MAIL_ATTACH_ITEM_UNKNOWN_ERROR,
MAIL_REMOVE_ITEM_ERROR,
+ MAIL_SEND_FATAL_ERROR,
+ MAIL_SEND_COUNT_ERROR,
+ MAIL_SEND_ITEM_ERROR,
+ MAIL_SEND_RECEIVER_ERROR,
TYPE_END
};
diff --git a/src/gui/windows/maileditwindow.cpp b/src/gui/windows/maileditwindow.cpp
index ec9b32825..5dfa769f6 100644
--- a/src/gui/windows/maileditwindow.cpp
+++ b/src/gui/windows/maileditwindow.cpp
@@ -191,6 +191,7 @@ void MailEditWindow::close()
{
if (mUseMail2)
mail2Handler->cancelWriteMail();
+ mailEditWindow = nullptr;
scheduleDelete();
}
diff --git a/src/net/eathena/mail2recv.cpp b/src/net/eathena/mail2recv.cpp
index fe36172b9..e3dc5b9da 100644
--- a/src/net/eathena/mail2recv.cpp
+++ b/src/net/eathena/mail2recv.cpp
@@ -295,8 +295,30 @@ void Mail2Recv::processCheckNameResult(Net::MessageIn &msg)
void Mail2Recv::processSendResult(Net::MessageIn &msg)
{
- UNIMPLEMENTEDPACKET;
- msg.readUInt8("result");
+ const int res = msg.readUInt8("result");
+ switch (res)
+ {
+ case 0:
+ NotifyManager::notify(NotifyTypes::MAIL_SEND_OK);
+ if (mailEditWindow != nullptr)
+ mailEditWindow->close();
+ break;
+ case 1:
+ NotifyManager::notify(NotifyTypes::MAIL_SEND_FATAL_ERROR);
+ break;
+ case 2:
+ NotifyManager::notify(NotifyTypes::MAIL_SEND_COUNT_ERROR);
+ break;
+ case 3:
+ NotifyManager::notify(NotifyTypes::MAIL_SEND_ITEM_ERROR);
+ break;
+ case 4:
+ NotifyManager::notify(NotifyTypes::MAIL_SEND_RECEIVER_ERROR);
+ break;
+ default:
+ NotifyManager::notify(NotifyTypes::MAIL_SEND_ERROR);
+ break;
+ }
}
void Mail2Recv::processMailListPage(Net::MessageIn &msg)
diff --git a/src/resources/notifications.h b/src/resources/notifications.h
index 61d4cdb86..a5b7a725f 100644
--- a/src/resources/notifications.h
+++ b/src/resources/notifications.h
@@ -877,6 +877,22 @@ namespace NotifyManager
// TRANSLATORS: notification message
N_("Item %s remove failed."),
NotifyFlags::STRING},
+ {"mail send fatal error",
+ // TRANSLATORS: notification message
+ N_("Mail send failed. Fatal error."),
+ NotifyFlags::EMPTY},
+ {"mail send count error",
+ // TRANSLATORS: notification message
+ N_("Mail send failed. Too mail mails sent."),
+ NotifyFlags::EMPTY},
+ {"mail send item error",
+ // TRANSLATORS: notification message
+ N_("Mail send failed. Wrong attach found."),
+ NotifyFlags::EMPTY},
+ {"mail send receiver error",
+ // TRANSLATORS: notification message
+ N_("Mail send failed. Receiver name wrong or not checked."),
+ NotifyFlags::EMPTY},
};
} // namespace NotifyManager
#endif // RESOURCES_NOTIFICATIONS_H