summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-23 21:59:43 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-23 21:59:43 +0300
commit1a652f220d1c74333cd2f54953dbaf41907314b6 (patch)
treefdaf09d8cb84ca036bdf73c47b0de5165d9e773d
parent475aa157df7400ce40ef9a5cc4cb441291d45df9 (diff)
downloadmanaverse-1a652f220d1c74333cd2f54953dbaf41907314b6.tar.gz
manaverse-1a652f220d1c74333cd2f54953dbaf41907314b6.tar.bz2
manaverse-1a652f220d1c74333cd2f54953dbaf41907314b6.tar.xz
manaverse-1a652f220d1c74333cd2f54953dbaf41907314b6.zip
Move chat command /query into actions.
-rw-r--r--src/actions/chat.cpp21
-rw-r--r--src/actions/chat.h1
-rw-r--r--src/commands.cpp21
-rw-r--r--src/commands.h9
-rw-r--r--src/input/inputaction.h1
-rw-r--r--src/input/inputactionmap.h9
6 files changed, 33 insertions, 29 deletions
diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp
index 08b3e0014..858b5acbb 100644
--- a/src/actions/chat.cpp
+++ b/src/actions/chat.cpp
@@ -211,4 +211,25 @@ impHandler(msg)
return true;
}
+impHandler(query)
+{
+ if (chatWindow)
+ {
+ if (chatWindow->addWhisperTab(event.args, true))
+ {
+ chatWindow->saveState();
+ return true;
+ }
+ }
+
+ if (event.tab)
+ {
+ // TRANSLATORS: new whisper query
+ event.tab->chatLog(strprintf(_("Cannot create a whisper tab for nick "
+ "\"%s\"! It either already exists, or is you."),
+ event.args.c_str()), ChatMsgType::BY_SERVER);
+ }
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/chat.h b/src/actions/chat.h
index b653e6efb..fe35021be 100644
--- a/src/actions/chat.h
+++ b/src/actions/chat.h
@@ -36,6 +36,7 @@ namespace Actions
decHandler(scrollChatUp);
decHandler(scrollChatDown);
decHandler(msg);
+ decHandler(query);
} // namespace Actions
#undef decHandler
diff --git a/src/commands.cpp b/src/commands.cpp
index c80c2cf3f..8e90532c8 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -251,27 +251,6 @@ static void outStringNormal(ChatTab *const tab,
}
}
-impHandler(query)
-{
- if (chatWindow)
- {
- if (chatWindow->addWhisperTab(event.args, true))
- {
- chatWindow->saveState();
- return true;
- }
- }
-
- if (event.tab)
- {
- // TRANSLATORS: new whisper query
- event.tab->chatLog(strprintf(_("Cannot create a whisper tab for nick "
- "\"%s\"! It either already exists, or is you."),
- event.args.c_str()), ChatMsgType::BY_SERVER);
- }
- return true;
-}
-
impHandler0(clear)
{
if (chatWindow)
diff --git a/src/commands.h b/src/commands.h
index c5731e459..9c18eb1df 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -51,7 +51,6 @@ struct CommandInfo final
namespace Commands
{
- decHandler(query);
decHandler(clear);
decHandler(cleanGraphics);
decHandler(cleanFonts);
@@ -136,11 +135,7 @@ namespace Commands
enum
{
- COMMAND_WHISPER = 0,
- COMMAND_W,
- COMMAND_QUERY,
- COMMAND_Q,
- COMMAND_IGNORE,
+ COMMAND_IGNORE = 0,
COMMAND_UNIGNORE,
COMMAND_FRIEND,
COMMAND_BEFRIEND,
@@ -225,8 +220,6 @@ enum
static const CommandInfo commands[] =
{
- {"query", Commands::query, -1, true},
- {"q", &Commands::query, -1, true},
{"ignore", &Commands::ignore, -1, true},
{"unignore", &Commands::unignore, -1, true},
{"friend", Commands::beFriend, -1, true},
diff --git a/src/input/inputaction.h b/src/input/inputaction.h
index 852529934..15af94ec7 100644
--- a/src/input/inputaction.h
+++ b/src/input/inputaction.h
@@ -348,6 +348,7 @@ namespace InputAction
WHERE,
WHO,
WHISPER,
+ QUERY,
TOTAL
};
} // namespace InputAction
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 165457b27..fc2b601b6 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -2901,6 +2901,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
InputAction::NO_VALUE, 50,
InputCondition::INGAME,
"w|whisper|msg",
+ true},
+ {"keyQuery",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT,
+ &Actions::query,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "q|query",
true}
};