diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-08-27 13:18:28 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-08-27 13:18:28 +0300 |
commit | d53578d459fcc7fc9c5ab84a196c7f5a8238fc8e (patch) | |
tree | 8f83fc62a0bc58fef5a62bdb53e7bcf07f005a13 /src | |
parent | 2981363fef524501a4a24a5f4c60661ebdee80fa (diff) | |
download | manaplus-d53578d459fcc7fc9c5ab84a196c7f5a8238fc8e.tar.gz manaplus-d53578d459fcc7fc9c5ab84a196c7f5a8238fc8e.tar.bz2 manaplus-d53578d459fcc7fc9c5ab84a196c7f5a8238fc8e.tar.xz manaplus-d53578d459fcc7fc9c5ab84a196c7f5a8238fc8e.zip |
Move chat command /url into actions.
Diffstat (limited to 'src')
-rw-r--r-- | src/actions/commands.cpp | 16 | ||||
-rw-r--r-- | src/actions/commands.h | 1 | ||||
-rw-r--r-- | src/commands.cpp | 14 | ||||
-rw-r--r-- | src/commands.h | 5 | ||||
-rw-r--r-- | src/input/inputaction.h | 1 | ||||
-rw-r--r-- | src/input/inputactionmap.h | 11 |
6 files changed, 29 insertions, 19 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 018cca54a..ab116d805 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -75,6 +75,7 @@ #include "net/pethandler.h" #include "net/net.h" +#include "utils/chatutils.h" #include "utils/gettext.h" #include "utils/stringutils.h" @@ -530,4 +531,19 @@ impHandler(setDrop) return true; } +impHandler(url) +{ + if (event.tab) + { + std::string url = event.args; + if (!strStartWith(url, "http") && !strStartWith(url, "?")) + url = "http://" + url; + std::string str(strprintf("[@@%s |%s@@]", + url.c_str(), event.args.c_str())); + outStringNormal(event.tab, str, str); + return true; + } + return false; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index b171e49e2..d57f3d469 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -56,6 +56,7 @@ namespace Actions decHandler(removeAttack); decHandler(addIgnoreAttack); decHandler(setDrop); + decHandler(url); } // namespace Actions #undef decHandler diff --git a/src/commands.cpp b/src/commands.cpp index b534c8616..77ee7e5b7 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -106,20 +106,6 @@ impHandler(hack) return true; } -impHandler(url) -{ - if (event.tab) - { - std::string url = event.args; - if (!strStartWith(url, "http") && !strStartWith(url, "?")) - url = "http://" + url; - std::string str(strprintf("[@@%s |%s@@]", url.c_str(), event.args.c_str())); - outStringNormal(event.tab, str, str); - return true; - } - return false; -} - impHandler(open) { std::string url = event.args; diff --git a/src/commands.h b/src/commands.h index cf2491476..6178b9d47 100644 --- a/src/commands.h +++ b/src/commands.h @@ -52,7 +52,6 @@ struct CommandInfo final namespace Commands { decHandler(hack); - decHandler(url); decHandler(open); decHandler(execute); decHandler(testsdlfont); @@ -77,8 +76,7 @@ namespace Commands enum { - COMMAND_URL = 0, - COMMAND_OPEN, + COMMAND_OPEN = 0, COMMAND_EXECUTE, COMMAND_TESTSDLFONT, COMMAND_ENABLEHIGHLIGHT, @@ -102,7 +100,6 @@ enum static const CommandInfo commands[] = { - {"url", &Commands::url, -1, true}, {"open", &Commands::open, -1, true}, {"execute", &Commands::execute, -1, true}, {"testsdlfont", &Commands::testsdlfont, -1, false}, diff --git a/src/input/inputaction.h b/src/input/inputaction.h index 6758492b9..32afb69f1 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -404,6 +404,7 @@ namespace InputAction DUMP_OGL, DUMP_GL, DUMP_MODS, + URL, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 5e3260584..22fc6ce11 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -3405,7 +3405,16 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputAction::NO_VALUE, 50, InputCondition::INGAME, "dumpMods", - false} + false}, + {"keyUrl", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::url, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "url", + true} }; #endif // INPUT_INPUTACTIONMAP_H |