From 75604ffe8c2ef1f2d76a44dc30e8a257b695daf5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 23 Aug 2017 01:12:26 +0300 Subject: Add ability to send new mail by /sendmail chat command. --- src/actions/commands.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/actions/commands.cpp') diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index a415a2117..18560f8df 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -63,6 +63,7 @@ #include "net/guildhandler.h" #include "net/familyhandler.h" #include "net/homunculushandler.h" +#include "net/mail2handler.h" #include "net/mailhandler.h" #include "net/net.h" #include "net/npchandler.h" @@ -555,22 +556,41 @@ impHandler(imitation) impHandler(sendMail) { const ServerTypeT type = Net::getNetworkType(); +#ifdef TMWA_SUPPORT if (type == ServerType::EATHENA || type == ServerType::EVOL2) +#endif // TMWA_SUPPORT { std::string name; std::string text; if (parse2Str(event.args, name, text)) { - // TRANSLATORS: quick mail message caption - mailHandler->send(name, _("Quick message"), text); + if (settings.enableNewMailSystem) + { + if (mail2Handler->queueSendMail(name, + // TRANSLATORS: quick mail message caption + _("Quick message"), + text, + 0)) + { + mail2Handler->requestCheckName(name); + } + } + else + { + // TRANSLATORS: quick mail message caption + mailHandler->send(name, _("Quick message"), text); + } } } +#ifdef TMWA_SUPPORT else if (serverConfig.getBoolValue("enableManaMarketBot")) { chatHandler->privateMessage("ManaMarket", "!mail " + event.args); return true; } +#endif // TMWA_SUPPORT + return false; } -- cgit v1.2.3-70-g09d2