diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-05-28 21:38:53 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-05-28 21:42:50 -0600 |
commit | ec1c6bc0d44d0b6b94607d36a8cd28e6c4e484cd (patch) | |
tree | 02ca63f23cadb2ee432b33a48bcde6dbd343af09 /src/commandhandler.cpp | |
parent | 08f7e0c085078d863b822d6e65adceb64b264004 (diff) | |
download | mana-client-ec1c6bc0d44d0b6b94607d36a8cd28e6c4e484cd.tar.gz mana-client-ec1c6bc0d44d0b6b94607d36a8cd28e6c4e484cd.tar.bz2 mana-client-ec1c6bc0d44d0b6b94607d36a8cd28e6c4e484cd.tar.xz mana-client-ec1c6bc0d44d0b6b94607d36a8cd28e6c4e484cd.zip |
Add /ignore and /unignore commands
These make it easy to ignore/unignore other players that aren't visible.
Special versions are also available in WhisperTabs that don't need a
name given.
Diffstat (limited to 'src/commandhandler.cpp')
-rw-r--r-- | src/commandhandler.cpp | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index 0af77398..d2a303e8 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -25,6 +25,7 @@ #include "channel.h" #include "game.h" #include "localplayer.h" +#include "playerrelations.h" #include "gui/widgets/channeltab.h" #include "gui/widgets/chattab.h" @@ -76,6 +77,14 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab) { handleQuery(args, tab); } + else if (type == "ignore") + { + handleIgnore(args, tab); + } + else if (type == "unignore") + { + handleUnignore(args, tab); + } else if (type == "join") { handleJoin(args, tab); @@ -154,6 +163,9 @@ void CommandHandler::handleHelp(const std::string &args, ChatTab *tab) tab->chatLog(_("/query > Makes a tab for private messages with another user")); tab->chatLog(_("/q > Alias of query")); + tab->chatLog(_("/ignore > ignore a player")); + tab->chatLog(_("/unignore > stop ignoring a player")); + tab->chatLog(_("/list > Display all public channels")); tab->chatLog(_("/join > Join or create a channel")); @@ -192,6 +204,12 @@ void CommandHandler::handleHelp(const std::string &args, ChatTab *tab) tab->chatLog(_("Command: /clear")); tab->chatLog(_("This command clears the chat log of previous chat.")); } + else if (args == "ignore") + { + tab->chatLog(_("Command: /ignore <player>")); + tab->chatLog(_("This command ignores the given player reguardless of " + "current relations.")); + } else if (args == "join") { tab->chatLog(_("Command: /join <channel>")); @@ -257,6 +275,12 @@ void CommandHandler::handleHelp(const std::string &args, ChatTab *tab) tab->chatLog(_("Command: /toggle")); tab->chatLog(_("This command displays the return toggle status.")); } + else if (args == "unignore") + { + tab->chatLog(_("Command: /unignore <player>")); + tab->chatLog(_("This command stops ignoring the given player if they " + "are being ignored")); + } else if (args == "where") { tab->chatLog(_("Command: /where")); @@ -416,3 +440,47 @@ void CommandHandler::handlePresent(const std::string &args, ChatTab *tab) { chatWindow->doPresent(); } + +void CommandHandler::handleIgnore(const std::string &args, ChatTab *tab) +{ + if (args.empty()) + { + tab->chatLog(_("Please specify a name."), BY_SERVER); + return; + } + + if (player_relations.getRelation(args) == PlayerRelation::IGNORED) + { + tab->chatLog(_("Player already ignored!"), BY_SERVER); + return; + } + else + player_relations.setRelation(args, PlayerRelation::IGNORED); + + if (player_relations.getRelation(args) == PlayerRelation::IGNORED) + tab->chatLog(_("Player successfully ignored!"), BY_SERVER); + else + tab->chatLog(_("Player could not be ignored!"), BY_SERVER); +} + +void CommandHandler::handleUnignore(const std::string &args, ChatTab *tab) +{ + if (args.empty()) + { + tab->chatLog(_("Please specify a name."), BY_SERVER); + return; + } + + if (player_relations.getRelation(args) == PlayerRelation::IGNORED) + player_relations.removePlayer(args); + else + { + tab->chatLog(_("Player wasn't ignored!"), BY_SERVER); + return; + } + + if (player_relations.getRelation(args) != PlayerRelation::IGNORED) + tab->chatLog(_("Player no longer ignored!"), BY_SERVER); + else + tab->chatLog(_("Player could not be unignored!"), BY_SERVER); +} |