summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-07 01:13:22 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-07 01:13:22 +0300
commit086356622db7b0734be68c58e064544fa243be1b (patch)
tree1688cd334f620dadfff25f3430f496908c4b528f
parent615445b73ce4378a9d62e64d9f90cefdb26979c7 (diff)
downloadmv-086356622db7b0734be68c58e064544fa243be1b.tar.gz
mv-086356622db7b0734be68c58e064544fa243be1b.tar.bz2
mv-086356622db7b0734be68c58e064544fa243be1b.tar.xz
mv-086356622db7b0734be68c58e064544fa243be1b.zip
Add /mailto chat command.
-rw-r--r--src/actions/commands.cpp14
-rw-r--r--src/actions/commands.h1
-rw-r--r--src/dyetool/actions/commands.cpp1
-rw-r--r--src/enums/input/inputaction.h1
-rw-r--r--src/gui/windows/mailwindow.cpp9
-rw-r--r--src/gui/windows/mailwindow.h2
-rw-r--r--src/input/inputactionmap.h6
7 files changed, 34 insertions, 0 deletions
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<MailMessage*> mMessages;
std::map<int, MailMessage*> 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