summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-27 16:32:44 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-27 16:32:44 +0300
commit60c983e043b9ec502b65785306887003f5bcb27b (patch)
treef563332745eea7bb17fa31046db74364e4183ad4 /src
parentde2e84a86c3419a41de594951c452e25dde60d86 (diff)
downloadmanaverse-60c983e043b9ec502b65785306887003f5bcb27b.tar.gz
manaverse-60c983e043b9ec502b65785306887003f5bcb27b.tar.bz2
manaverse-60c983e043b9ec502b65785306887003f5bcb27b.tar.xz
manaverse-60c983e043b9ec502b65785306887003f5bcb27b.zip
Move chat command /uploadlog into actions.
Diffstat (limited to 'src')
-rw-r--r--src/actions/actions.cpp9
-rw-r--r--src/actions/actions.h1
-rw-r--r--src/commands.cpp9
-rw-r--r--src/commands.h5
-rw-r--r--src/input/inputaction.h1
-rw-r--r--src/input/inputactionmap.h9
-rw-r--r--src/input/pages/other.cpp6
-rw-r--r--src/listeners/uploadlistener.cpp6
8 files changed, 29 insertions, 17 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index 7eab1f928..8e2f3623b 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -1155,4 +1155,13 @@ impHandler(uploadServerConfig)
return true;
}
+impHandler(uploadLog)
+{
+ uploadFile(_("Uploaded log into:"),
+ settings.logFileName,
+ "?txt",
+ event.tab);
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/actions.h b/src/actions/actions.h
index 2997180c4..f241b321c 100644
--- a/src/actions/actions.h
+++ b/src/actions/actions.h
@@ -86,6 +86,7 @@ namespace Actions
decHandler(createItems);
decHandler(uploadConfig);
decHandler(uploadServerConfig);
+ decHandler(uploadLog);
} // namespace Actions
#undef decHandler
diff --git a/src/commands.cpp b/src/commands.cpp
index 585d44cc5..1e859888f 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -171,15 +171,6 @@ static void uploadFile(const std::string &str,
upload->start();
}
-impHandler(uploadLog)
-{
- uploadFile(_("Uploaded log into:"),
- settings.logFileName,
- "?txt",
- event.tab);
- return true;
-}
-
impHandler0(debugSpawn)
{
int cnt = atoi(event.args.c_str());
diff --git a/src/commands.h b/src/commands.h
index 4feffefbd..553b97ba4 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -52,7 +52,6 @@ struct CommandInfo final
namespace Commands
{
decHandler(hack);
- decHandler(uploadLog);
decHandler(gm);
decHandler(debugSpawn);
@@ -61,8 +60,7 @@ namespace Commands
enum
{
- COMMAND_UPLOADLOG = 0,
- COMMAND_GM,
+ COMMAND_GM = 0,
COMMAND_HACK,
COMMAND_DEBUGSPAWN,
END_COMMANDS
@@ -70,7 +68,6 @@ enum
static const CommandInfo commands[] =
{
- {"uploadlog", &Commands::uploadLog, -1, false},
{"gm", &Commands::gm, -1, true},
{"hack", &Commands::hack, -1, true},
{"debugSpawn", &Commands::debugSpawn, -1, true}
diff --git a/src/input/inputaction.h b/src/input/inputaction.h
index cf7886bf5..93a3a48a7 100644
--- a/src/input/inputaction.h
+++ b/src/input/inputaction.h
@@ -420,6 +420,7 @@ namespace InputAction
TALK_PET,
UPLOAD_CONFIG,
UPLOAD_SERVER_CONFIG,
+ UPLOAD_LOG,
TOTAL
};
} // namespace InputAction
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 1af14ffc7..aa9432b06 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -3557,6 +3557,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
InputAction::NO_VALUE, 50,
InputCondition::INGAME,
"uploadserverconfig",
+ false},
+ {"keyUploadLog",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT,
+ &Actions::uploadLog,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "uploadlog",
false}
};
diff --git a/src/input/pages/other.cpp b/src/input/pages/other.cpp
index 6369a509f..9d16f4b8a 100644
--- a/src/input/pages/other.cpp
+++ b/src/input/pages/other.cpp
@@ -360,6 +360,12 @@ SetupActionData setupActionDataOther[] =
"",
},
{
+ // TRANSLATORS: input action name
+ N_("Upload log file"),
+ InputAction::UPLOAD_LOG,
+ "",
+ },
+ {
"",
InputAction::NO_VALUE,
""
diff --git a/src/listeners/uploadlistener.cpp b/src/listeners/uploadlistener.cpp
index 0403d9af0..7e9590f82 100644
--- a/src/listeners/uploadlistener.cpp
+++ b/src/listeners/uploadlistener.cpp
@@ -20,8 +20,7 @@
#include "listeners/uploadlistener.h"
-#include "commandhandler.h"
-#include "commands.h"
+#include "input/inputmanager.h"
#include "debug.h"
@@ -29,6 +28,5 @@ UploadListener uploadListener;
void UploadListener::action(const ActionEvent &event A_UNUSED)
{
- if (commandHandler)
- commandHandler->invokeCommand(COMMAND_UPLOADLOG, "");
+ inputManager.executeAction(InputAction::UPLOAD_LOG);
}