From 086356622db7b0734be68c58e064544fa243be1b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 7 Mar 2016 01:13:22 +0300 Subject: Add /mailto chat command. --- src/actions/commands.cpp | 14 ++++++++++++++ src/actions/commands.h | 1 + src/dyetool/actions/commands.cpp | 1 + src/enums/input/inputaction.h | 1 + src/gui/windows/mailwindow.cpp | 9 +++++++++ src/gui/windows/mailwindow.h | 2 ++ src/input/inputactionmap.h | 6 ++++++ 7 files changed, 34 insertions(+) (limited to 'src') diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index e10d31d43..fa4ea6767 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -39,6 +39,8 @@ #ifdef EATHENA_SUPPORT #include "gui/shortcut/emoteshortcut.h" + +#include "gui/windows/mailwindow.h" #endif #include "gui/windows/chatwindow.h" @@ -1559,4 +1561,16 @@ impHandler(commandGuildRecall) return true; } +impHandler(mailTo) +{ +#ifdef EATHENA_SUPPORT + if (!mailWindow) + return false; + mailWindow->createMail(event.args); + return true; +#else + return false; +#endif +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index 41db1e042..76dc683e9 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -138,6 +138,7 @@ namespace Actions decHandler(commandPartyRecall); decHandler(commandBreakGuild); decHandler(commandGuildRecall); + decHandler(mailTo); } // namespace Actions #undef decHandler diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp index 1da8b9540..bc61b1a3d 100644 --- a/src/dyetool/actions/commands.cpp +++ b/src/dyetool/actions/commands.cpp @@ -138,5 +138,6 @@ impHandlerVoid(commandChangePartyLeader) impHandlerVoid(commandPartyRecall) impHandlerVoid(commandBreakGuild) impHandlerVoid(commandGuildRecall) +impHandlerVoid(mailTo) } // namespace Actions diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index 71a0e4631..f7663ae7f 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -667,6 +667,7 @@ enumStart(InputAction) COMMAND_PARTY_RECALL, COMMAND_BREAK_GUILD, COMMAND_GUILD_RECALL, + MAIL_TO, TOTAL } enumEnd(InputAction); diff --git a/src/gui/windows/mailwindow.cpp b/src/gui/windows/mailwindow.cpp index 071a1ecee..87b732bf8 100644 --- a/src/gui/windows/mailwindow.cpp +++ b/src/gui/windows/mailwindow.cpp @@ -283,3 +283,12 @@ void MailWindow::postConnection() { mailHandler->refresh(); } + +void MailWindow::createMail(const std::string &to) +{ + if (mailEditWindow) + return; + + CREATEWIDGETV0(mailEditWindow, MailEditWindow); + mailEditWindow->setTo(to); +} diff --git a/src/gui/windows/mailwindow.h b/src/gui/windows/mailwindow.h index 6500542c9..1a78c1de9 100644 --- a/src/gui/windows/mailwindow.h +++ b/src/gui/windows/mailwindow.h @@ -67,6 +67,8 @@ class MailWindow final : public Window, void postConnection(); + void createMail(const std::string &to); + private: std::vector mMessages; std::map mMessagesMap; diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index e2e2a8b14..40eff9e7c 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5491,6 +5491,12 @@ static const InputActionData inputActionData "guildrecall|recallguild", UseArgs_true, Protected_true}, + {"keyMailTo", + defaultAction(&Actions::mailTo), + InputCondition::INGAME, + "mailto", + UseArgs_true, + Protected_false}, }; #undef defaultAction -- cgit v1.2.3-70-g09d2