diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-08-24 17:14:07 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-08-24 17:14:07 +0300 |
commit | f5651bc452096c8cd84d7c801228d64af3a165d2 (patch) | |
tree | afc3a673675dbae99b30e5c61be6bf713cb70395 /src/actions | |
parent | c33d54dd45efd88f95014bd41813accb15e76f89 (diff) | |
download | manaverse-f5651bc452096c8cd84d7c801228d64af3a165d2.tar.gz manaverse-f5651bc452096c8cd84d7c801228d64af3a165d2.tar.bz2 manaverse-f5651bc452096c8cd84d7c801228d64af3a165d2.tar.xz manaverse-f5651bc452096c8cd84d7c801228d64af3a165d2.zip |
Move chat command /unignore into actions.
Diffstat (limited to 'src/actions')
-rw-r--r-- | src/actions/commands.cpp | 48 | ||||
-rw-r--r-- | src/actions/commands.h | 1 |
2 files changed, 49 insertions, 0 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 |