diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-08-23 01:12:26 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-08-23 01:12:26 +0300 |
commit | 75604ffe8c2ef1f2d76a44dc30e8a257b695daf5 (patch) | |
tree | 5cb43dcb41627d3313ba3d2a371b1a597fd3bab5 /src/net/eathena/mail2handler.cpp | |
parent | 17e9519c2ee0b126db5ba1df61dcddf9f7b90b47 (diff) | |
download | plus-75604ffe8c2ef1f2d76a44dc30e8a257b695daf5.tar.gz plus-75604ffe8c2ef1f2d76a44dc30e8a257b695daf5.tar.bz2 plus-75604ffe8c2ef1f2d76a44dc30e8a257b695daf5.tar.xz plus-75604ffe8c2ef1f2d76a44dc30e8a257b695daf5.zip |
Add ability to send new mail by /sendmail chat command.
Diffstat (limited to 'src/net/eathena/mail2handler.cpp')
-rw-r--r-- | src/net/eathena/mail2handler.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/net/eathena/mail2handler.cpp b/src/net/eathena/mail2handler.cpp index 52360d7b7..513994d2a 100644 --- a/src/net/eathena/mail2handler.cpp +++ b/src/net/eathena/mail2handler.cpp @@ -24,10 +24,12 @@ #include "being/localplayer.h" +#include "net/eathena/mail2recv.h" #include "net/eathena/messageout.h" #include "net/eathena/protocolout.h" #include "utils/checkutils.h" +#include "utils/dtor.h" #include "resources/item/item.h" @@ -47,6 +49,12 @@ Mail2Handler::Mail2Handler() Mail2Handler::~Mail2Handler() { mail2Handler = nullptr; + while (!Mail2Recv::mMailQueue.empty()) + { + MailQueue *const mail = Mail2Recv::mMailQueue.front(); + delete mail; + Mail2Recv::mMailQueue.pop(); + } } void Mail2Handler::openWriteMail(const std::string &receiver) const @@ -132,6 +140,23 @@ void Mail2Handler::sendMail(const std::string &to, outMsg.writeString(body, bodySz, "body"); } +bool Mail2Handler::queueSendMail(const std::string &to, + const std::string &title, + const std::string &body, + const int64_t &money) const +{ + if (!Mail2Recv::mMailQueue.empty()) + return false; + MailQueue *const mail = new MailQueue; + mail->to = to; + mail->title = title; + mail->body = body; + mail->money = money; + mail->sendMail = true; + Mail2Recv::mMailQueue.push(mail); + return true; +} + void Mail2Handler::nextPage(const MailOpenTypeT openType, const int64_t mailId) const { |