summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-27 13:23:40 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-27 13:23:40 +0300
commit9761d1af134b3e699a29262abdddbe86f2b8dfe3 (patch)
tree17cf626334a326a9aaa9e328e039fc3d96a2d2a7
parentd53578d459fcc7fc9c5ab84a196c7f5a8238fc8e (diff)
downloadmanaplus-9761d1af134b3e699a29262abdddbe86f2b8dfe3.tar.gz
manaplus-9761d1af134b3e699a29262abdddbe86f2b8dfe3.tar.bz2
manaplus-9761d1af134b3e699a29262abdddbe86f2b8dfe3.tar.xz
manaplus-9761d1af134b3e699a29262abdddbe86f2b8dfe3.zip
Move chat command /open into actions.
-rw-r--r--src/actions/commands.cpp10
-rw-r--r--src/actions/commands.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
6 files changed, 22 insertions, 13 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index ab116d805..28b601ba2 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -77,6 +77,7 @@
#include "utils/chatutils.h"
#include "utils/gettext.h"
+#include "utils/process.h"
#include "utils/stringutils.h"
#include "debug.h"
@@ -546,4 +547,13 @@ impHandler(url)
return false;
}
+impHandler(openUrl)
+{
+ std::string url = event.args;
+ if (!strStartWith(url, "http"))
+ url = "http://" + url;
+ openBrowser(url);
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/commands.h b/src/actions/commands.h
index d57f3d469..3b378931d 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -57,6 +57,7 @@ namespace Actions
decHandler(addIgnoreAttack);
decHandler(setDrop);
decHandler(url);
+ decHandler(openUrl);
} // namespace Actions
#undef decHandler
diff --git a/src/commands.cpp b/src/commands.cpp
index 77ee7e5b7..3cc659b0c 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -106,15 +106,6 @@ impHandler(hack)
return true;
}
-impHandler(open)
-{
- std::string url = event.args;
- if (!strStartWith(url, "http"))
- url = "http://" + url;
- openBrowser(url);
- return true;
-}
-
impHandler(execute)
{
const size_t idx = event.args.find(" ");
diff --git a/src/commands.h b/src/commands.h
index 6178b9d47..5abfae4da 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -52,7 +52,6 @@ struct CommandInfo final
namespace Commands
{
decHandler(hack);
- decHandler(open);
decHandler(execute);
decHandler(testsdlfont);
decHandler(enableHighlight);
@@ -76,8 +75,7 @@ namespace Commands
enum
{
- COMMAND_OPEN = 0,
- COMMAND_EXECUTE,
+ COMMAND_EXECUTE = 0,
COMMAND_TESTSDLFONT,
COMMAND_ENABLEHIGHLIGHT,
COMMAND_DISABLEHIGHLIGHT,
@@ -100,7 +98,6 @@ enum
static const CommandInfo commands[] =
{
- {"open", &Commands::open, -1, true},
{"execute", &Commands::execute, -1, true},
{"testsdlfont", &Commands::testsdlfont, -1, false},
{"enablehighlight", &Commands::enableHighlight, -1, false},
diff --git a/src/input/inputaction.h b/src/input/inputaction.h
index 32afb69f1..0a9e8ec21 100644
--- a/src/input/inputaction.h
+++ b/src/input/inputaction.h
@@ -405,6 +405,7 @@ namespace InputAction
DUMP_GL,
DUMP_MODS,
URL,
+ OPEN_URL,
TOTAL
};
} // namespace InputAction
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 22fc6ce11..d40a0ae99 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -3414,6 +3414,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
InputAction::NO_VALUE, 50,
InputCondition::INGAME,
"url",
+ true},
+ {"keyOpenUrl",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT,
+ &Actions::openUrl,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "open",
true}
};