summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-27 15:40:34 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-27 15:40:34 +0300
commit0b9105af0ae2b85a0a3ea5364d8a854d107ce34a (patch)
tree10d4c2e846010e55fe7a48cc9e84502938ef16ab
parentba4e639a333eed40f95f7bf7a361c0bd0186c334 (diff)
downloadplus-0b9105af0ae2b85a0a3ea5364d8a854d107ce34a.tar.gz
plus-0b9105af0ae2b85a0a3ea5364d8a854d107ce34a.tar.bz2
plus-0b9105af0ae2b85a0a3ea5364d8a854d107ce34a.tar.xz
plus-0b9105af0ae2b85a0a3ea5364d8a854d107ce34a.zip
Move chat command /disableaway into actions.
-rw-r--r--src/actions/commands.cpp12
-rw-r--r--src/actions/commands.h1
-rw-r--r--src/commands.cpp12
-rw-r--r--src/commands.h5
-rw-r--r--src/gui/popups/popupmenu.cpp4
-rw-r--r--src/input/inputaction.h1
-rw-r--r--src/input/inputactionmap.h9
7 files changed, 26 insertions, 18 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index 8a5cad3f2..aae31db26 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -622,4 +622,16 @@ impHandler(removeName)
return false;
}
+impHandler(disableAway)
+{
+ if (event.tab)
+ {
+ event.tab->setNoAway(true);
+ if (chatWindow)
+ chatWindow->saveState();
+ return true;
+ }
+ return false;
+}
+
} // namespace Actions
diff --git a/src/actions/commands.h b/src/actions/commands.h
index 0874cefaa..140877eb5 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -63,6 +63,7 @@ namespace Actions
decHandler(disableHighlight);
decHandler(dontRemoveName);
decHandler(removeName);
+ decHandler(disableAway);
} // namespace Actions
#undef decHandler
diff --git a/src/commands.cpp b/src/commands.cpp
index f2d7cd6ce..3a7bf28a2 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -106,18 +106,6 @@ impHandler(hack)
return true;
}
-impHandler(disableAway)
-{
- if (event.tab)
- {
- event.tab->setNoAway(true);
- if (chatWindow)
- chatWindow->saveState();
- return true;
- }
- return false;
-}
-
impHandler(enableAway)
{
if (event.tab)
diff --git a/src/commands.h b/src/commands.h
index de5e80d03..b2e2dabc4 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -52,7 +52,6 @@ struct CommandInfo final
namespace Commands
{
decHandler(hack);
- decHandler(disableAway);
decHandler(enableAway);
decHandler(testParticle);
decHandler(createItems);
@@ -69,8 +68,7 @@ namespace Commands
enum
{
- COMMAND_DISABLEAWAY = 0,
- COMMAND_ENABLEAWAY,
+ COMMAND_ENABLEAWAY = 0,
COMMAND_TEST_PARTICLE,
COMMAND_CREATEITEMS,
COMMAND_TALKRAW,
@@ -86,7 +84,6 @@ enum
static const CommandInfo commands[] =
{
- {"disableaway", &Commands::disableAway, -1, false},
{"enableaway", &Commands::enableAway, -1, false},
{"testparticle", &Commands::testParticle, -1, true},
{"createitems", &Commands::createItems, -1, false},
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index b3970e7aa..c06c98540 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -1475,8 +1475,8 @@ void PopupMenu::handleLink(const std::string &link,
}
else if (link == "disable away" && mTab)
{
- if (commandHandler)
- commandHandler->invokeCommand(COMMAND_DISABLEAWAY, mTab);
+ inputManager.executeChatCommand(InputAction::DISABLE_AWAY,
+ std::string(), mTab);
}
else if (link == "enable away" && mTab)
{
diff --git a/src/input/inputaction.h b/src/input/inputaction.h
index 36f9277b1..cfeef44c1 100644
--- a/src/input/inputaction.h
+++ b/src/input/inputaction.h
@@ -412,6 +412,7 @@ namespace InputAction
DISABLE_HIGHLIGHT,
DONT_REMOVE_NAME,
REMOVE_NAME,
+ DISABLE_AWAY,
TOTAL
};
} // namespace InputAction
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 244400d1b..d2d09c770 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -3485,6 +3485,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
InputAction::NO_VALUE, 50,
InputCondition::INGAME,
"removename",
+ false},
+ {"keyDisableAway",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT,
+ &Actions::disableAway,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "disableaway",
false}
};