diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-08-25 13:39:28 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-08-25 13:39:28 +0300 |
commit | 0ae262d137e24c44064f59102ff6b72b19c60b71 (patch) | |
tree | bc03b97a2c0fd007f6076daf18ce6e56c5630a49 /src/actions/chat.cpp | |
parent | a7c2351c708c38bf020e8e1250b6a78cb2b6f89e (diff) | |
download | manaverse-0ae262d137e24c44064f59102ff6b72b19c60b71.tar.gz manaverse-0ae262d137e24c44064f59102ff6b72b19c60b71.tar.bz2 manaverse-0ae262d137e24c44064f59102ff6b72b19c60b71.tar.xz manaverse-0ae262d137e24c44064f59102ff6b72b19c60b71.zip |
Move chat command /toggle into actions.
Diffstat (limited to 'src/actions/chat.cpp')
-rw-r--r-- | src/actions/chat.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp index 4396d438a..8f991dd5f 100644 --- a/src/actions/chat.cpp +++ b/src/actions/chat.cpp @@ -86,6 +86,10 @@ extern std::string tradePartnerName; extern QuitDialog *quitDialog; extern unsigned int tmwServerVersion; +// TRANSLATORS: chat option changed message +#define BOOLEAN_OPTIONS _("Options to /%s are \"yes\", \"no\", \"true\", "\ +"\"false\", \"1\", \"0\".") + namespace Actions { @@ -351,4 +355,46 @@ impHandler(me) return true; } +impHandler(toggle) +{ + if (event.args.empty()) + { + if (chatWindow && event.tab) + { + // TRANSLATORS: message from toggle chat command + event.tab->chatLog(chatWindow->getReturnTogglesChat() ? + _("Return toggles chat.") : _("Message closes chat.")); + } + return true; + } + + switch (parseBoolean(event.args)) + { + case 1: + if (event.tab) + { + // TRANSLATORS: message from toggle chat command + event.tab->chatLog(_("Return now toggles chat.")); + } + if (chatWindow) + chatWindow->setReturnTogglesChat(true); + return true; + case 0: + if (event.tab) + { + // TRANSLATORS: message from toggle chat command + event.tab->chatLog(_("Message now closes chat.")); + } + if (chatWindow) + chatWindow->setReturnTogglesChat(false); + return true; + case -1: + if (event.tab) + event.tab->chatLog(strprintf(BOOLEAN_OPTIONS, "toggle")); + return true; + default: + return true; + } +} + } // namespace Actions |