summaryrefslogtreecommitdiff
path: root/src/actions/commands.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-24 22:06:47 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-24 22:06:47 +0300
commitd9dc86b8dce433947c81ba87ad0bad83d4bc96f6 (patch)
tree02afde544303ab88ab5a1f726d7c3a6f5794e341 /src/actions/commands.cpp
parent4805bee18392b56f39be68b0d6a0384cbda0f846 (diff)
downloadmv-d9dc86b8dce433947c81ba87ad0bad83d4bc96f6.tar.gz
mv-d9dc86b8dce433947c81ba87ad0bad83d4bc96f6.tar.bz2
mv-d9dc86b8dce433947c81ba87ad0bad83d4bc96f6.tar.xz
mv-d9dc86b8dce433947c81ba87ad0bad83d4bc96f6.zip
Move chat command /erase into actions.
Diffstat (limited to 'src/actions/commands.cpp')
-rw-r--r--src/actions/commands.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index 5c16d17cc..2b4c40b0e 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -184,6 +184,53 @@ impHandler(chatUnignore)
return true;
}
+impHandler(chatErase)
+{
+ 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();
+ }
+
+ if (player_relations.getRelation(args) == PlayerRelation::ERASED)
+ {
+ if (event.tab)
+ {
+ // TRANSLATORS: erase command
+ event.tab->chatLog(_("Player already erased!"), ChatMsgType::BY_SERVER);
+ }
+ return true;
+ }
+ else
+ {
+ player_relations.setRelation(args, PlayerRelation::ERASED);
+ }
+
+ if (event.tab)
+ {
+ if (player_relations.getRelation(args) == PlayerRelation::ERASED)
+ {
+ // TRANSLATORS: erase command
+ event.tab->chatLog(_("Player successfully erased!"),
+ ChatMsgType::BY_SERVER);
+ }
+ else
+ {
+ // TRANSLATORS: erase command
+ event.tab->chatLog(_("Player could not be erased!"),
+ ChatMsgType::BY_SERVER);
+ }
+ }
+ return true;
+}
+
impHandler(chatFriend)
{
// TRANSLATORS: adding friend command