summaryrefslogtreecommitdiff
path: root/src/actions/chat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/actions/chat.cpp')
-rw-r--r--src/actions/chat.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp
index 6e6f3cae1..266f610b8 100644
--- a/src/actions/chat.cpp
+++ b/src/actions/chat.cpp
@@ -28,6 +28,8 @@
#include "being/localplayer.h"
+#include "gui/sdlinput.h"
+
#include "gui/windows/chatwindow.h"
#include "listeners/inputactionreplaylistener.h"
@@ -48,6 +50,7 @@
#include "utils/booleanoptions.h"
#include "utils/chatutils.h"
+#include "utils/parameters.h"
#include "utils/translation/podict.h"
@@ -716,4 +719,38 @@ impHandler(translate)
return true;
}
+impHandler0(sendGuiKey)
+{
+ if (!guiInput)
+ return false;
+
+ const std::string args = event.args;
+ if (args.empty())
+ return false;
+ StringVect pars;
+ if (!splitParameters(pars, args, " ,", '\"'))
+ return false;
+ const int sz = CAST_S32(pars.size());
+ if (sz < 1)
+ return false;
+
+ int keyValue = atoi(pars[0].c_str());
+ if (keyValue == 0 &&
+ pars[0].size() == 1)
+ {
+ keyValue = CAST_S32(pars[0][0]);
+ }
+ if (sz == 2)
+ {
+ const InputActionT actionId = inputManager.getActionByConfigField(
+ pars[1]);
+ guiInput->simulateKey(keyValue, actionId);
+ }
+ else
+ {
+ guiInput->simulateKey(keyValue, InputAction::NO_VALUE);
+ }
+ return true;
+}
+
} // namespace Actions