summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-24 17:14:07 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-24 17:14:07 +0300
commitf5651bc452096c8cd84d7c801228d64af3a165d2 (patch)
treeafc3a673675dbae99b30e5c61be6bf713cb70395 /src
parentc33d54dd45efd88f95014bd41813accb15e76f89 (diff)
downloadplus-f5651bc452096c8cd84d7c801228d64af3a165d2.tar.gz
plus-f5651bc452096c8cd84d7c801228d64af3a165d2.tar.bz2
plus-f5651bc452096c8cd84d7c801228d64af3a165d2.tar.xz
plus-f5651bc452096c8cd84d7c801228d64af3a165d2.zip
Move chat command /unignore into actions.
Diffstat (limited to 'src')
-rw-r--r--src/actions/commands.cpp48
-rw-r--r--src/actions/commands.h1
-rw-r--r--src/commands.cpp45
-rw-r--r--src/commands.h5
-rw-r--r--src/gui/widgets/tabs/whispertab.cpp4
-rw-r--r--src/input/inputaction.h1
-rw-r--r--src/input/inputactionmap.h9
7 files changed, 60 insertions, 53 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index 7afc7efed..7e3d46446 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -136,4 +136,52 @@ impHandler(chatIgnore)
return true;
}
+impHandler(chatUnignore)
+{
+ std::string args = event.args;
+ if (args.empty())
+ {
+ WhisperTab *const whisper = dynamic_cast<WhisperTab* const>(event.tab);
+ if (!whisper || whisper->getNick().empty())
+ {
+ // TRANSLATORS: change relation
+ event.tab->chatLog(_("Please specify a name."), ChatMsgType::BY_SERVER);
+ return false;
+ }
+ args = whisper->getNick();
+ }
+
+ const PlayerRelation::Relation rel = player_relations.getRelation(args);
+ if (rel != PlayerRelation::NEUTRAL && rel != PlayerRelation::FRIEND)
+ {
+ player_relations.setRelation(args, PlayerRelation::NEUTRAL);
+ }
+ else
+ {
+ if (event.tab)
+ {
+ // TRANSLATORS: unignore command
+ event.tab->chatLog(_("Player wasn't ignored!"), ChatMsgType::BY_SERVER);
+ }
+ return true;
+ }
+
+ if (event.tab)
+ {
+ if (player_relations.getRelation(args) == PlayerRelation::NEUTRAL)
+ {
+ // TRANSLATORS: unignore command
+ event.tab->chatLog(_("Player no longer ignored!"),
+ ChatMsgType::BY_SERVER);
+ }
+ else
+ {
+ // TRANSLATORS: unignore command
+ event.tab->chatLog(_("Player could not be unignored!"),
+ ChatMsgType::BY_SERVER);
+ }
+ }
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/commands.h b/src/actions/commands.h
index 5f926c6ab..afc5e0dd9 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -29,6 +29,7 @@ namespace Actions
{
decHandler(chatAnnounce);
decHandler(chatIgnore);
+ decHandler(chatUnignore);
} // namespace Actions
#undef decHandler
diff --git a/src/commands.cpp b/src/commands.cpp
index b4a18aaf2..a4a531f36 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -405,51 +405,6 @@ impHandler(neutral)
return true;
}
-impHandler(unignore)
-{
- if (event.args.empty())
- {
- if (event.tab)
- {
- // TRANSLATORS: unignore command
- event.tab->chatLog(_("Please specify a name."), ChatMsgType::BY_SERVER);
- }
- return true;
- }
-
- const PlayerRelation::Relation rel = player_relations.getRelation(event.args);
- if (rel != PlayerRelation::NEUTRAL && rel != PlayerRelation::FRIEND)
- {
- player_relations.setRelation(event.args, PlayerRelation::NEUTRAL);
- }
- else
- {
- if (event.tab)
- {
- // TRANSLATORS: unignore command
- event.tab->chatLog(_("Player wasn't ignored!"), ChatMsgType::BY_SERVER);
- }
- return true;
- }
-
- if (event.tab)
- {
- if (player_relations.getRelation(event.args) == PlayerRelation::NEUTRAL)
- {
- // TRANSLATORS: unignore command
- event.tab->chatLog(_("Player no longer ignored!"),
- ChatMsgType::BY_SERVER);
- }
- else
- {
- // TRANSLATORS: unignore command
- event.tab->chatLog(_("Player could not be unignored!"),
- ChatMsgType::BY_SERVER);
- }
- }
- return true;
-}
-
impHandler(blackList)
{
// TRANSLATORS: blacklist command
diff --git a/src/commands.h b/src/commands.h
index cc10dfc45..2c8d08805 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -59,7 +59,6 @@ namespace Commands
decHandler(me);
decHandler(toggle);
decHandler(present);
- decHandler(unignore);
decHandler(beFriend);
decHandler(disregard);
decHandler(neutral);
@@ -133,8 +132,7 @@ namespace Commands
enum
{
- COMMAND_UNIGNORE = 0,
- COMMAND_FRIEND,
+ COMMAND_FRIEND = 0,
COMMAND_BEFRIEND,
COMMAND_DISREGARD,
COMMAND_NEUTRAL,
@@ -216,7 +214,6 @@ enum
static const CommandInfo commands[] =
{
- {"unignore", &Commands::unignore, -1, true},
{"friend", Commands::beFriend, -1, true},
{"befriend", &Commands::beFriend, -1, true},
{"disregard", &Commands::disregard, -1, true},
diff --git a/src/gui/widgets/tabs/whispertab.cpp b/src/gui/widgets/tabs/whispertab.cpp
index 04d390fe4..ad5ea6564 100644
--- a/src/gui/widgets/tabs/whispertab.cpp
+++ b/src/gui/widgets/tabs/whispertab.cpp
@@ -103,10 +103,6 @@ bool WhisperTab::handleCommand(const std::string &restrict type,
if (chatWindow)
chatWindow->defaultTab();
}
- else if (type == "unignore")
- {
- CommandHandler::invokeCommand(COMMAND_UNIGNORE, mNick, this);
- }
else
{
return false;
diff --git a/src/input/inputaction.h b/src/input/inputaction.h
index 1f59fc288..e5072eb1e 100644
--- a/src/input/inputaction.h
+++ b/src/input/inputaction.h
@@ -351,6 +351,7 @@ namespace InputAction
QUERY,
CLEAR_CHAT_TAB,
IGNORE,
+ UNIGNORE,
TOTAL
};
} // namespace InputAction
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index fc0e26755..10668f463 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -2928,6 +2928,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
InputAction::NO_VALUE, 50,
InputCondition::INGAME,
"ignore",
+ true},
+ {"keyUnignore",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT,
+ &Actions::chatUnignore,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "unignore",
true}
};