diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-03-08 12:29:10 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-03-08 12:29:10 +0300 |
commit | d1c4cb3675600137d0239ac7bdfc91062592804a (patch) | |
tree | e09c62c2e8a796bb745e0e3c2ed86810327ea3c5 /src | |
parent | 905bfd0ad38d7101f99f38b00044d9f192cc664d (diff) | |
download | mv-d1c4cb3675600137d0239ac7bdfc91062592804a.tar.gz mv-d1c4cb3675600137d0239ac7bdfc91062592804a.tar.bz2 mv-d1c4cb3675600137d0239ac7bdfc91062592804a.tar.xz mv-d1c4cb3675600137d0239ac7bdfc91062592804a.zip |
Move guild-kick from popup manager into actions.
Diffstat (limited to 'src')
-rw-r--r-- | src/actions/chat.cpp | 30 | ||||
-rw-r--r-- | src/actions/chat.h | 1 | ||||
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 35 | ||||
-rw-r--r-- | src/input/inputaction.h | 1 | ||||
-rw-r--r-- | src/input/inputactionmap.h | 5 |
5 files changed, 47 insertions, 25 deletions
diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp index 5014b24bc..2ac6ec0f1 100644 --- a/src/actions/chat.cpp +++ b/src/actions/chat.cpp @@ -456,6 +456,36 @@ impHandler(kickParty) return true; } +impHandler(kickGuild) +{ + if (!event.args.empty()) + { + if (localPlayer) + { + const Guild *const guild = localPlayer->getGuild(); + if (guild) + { + if (guild->getServerGuild()) + guildHandler->kick(guild->getMember(event.args), ""); +#ifdef TMWA_SUPPORT + else if (guildManager) + guildManager->kick(event.args); +#endif + } + } + } + else + { + if (event.tab) + { + // TRANSLATORS: party kick message + event.tab->chatLog(_("Please specify a name."), + ChatMsgType::BY_SERVER); + } + } + return true; +} + impHandler(addText) { if (chatWindow) diff --git a/src/actions/chat.h b/src/actions/chat.h index 1aa1778ef..9be293bb8 100644 --- a/src/actions/chat.h +++ b/src/actions/chat.h @@ -47,6 +47,7 @@ namespace Actions decHandler(me); decHandler(toggle); decHandler(kickParty); + decHandler(kickGuild); decHandler(addText); decHandler(clearChat); decHandler(chatGeneralTab); diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index bedc93259..1420d5714 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -183,7 +183,7 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) { if (guild1->getId() == guild2->getId()) { - mBrowserBox->addRow("guild-kick", + mBrowserBox->addRow("/kickguild 'NAME'", // TRANSLATORS: popup menu item // TRANSLATORS: kick player from guild _("Kick from guild")); @@ -199,7 +199,7 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) } else if (guild2->getMember(mNick)) { - mBrowserBox->addRow("guild-kick", + mBrowserBox->addRow("/kickguild 'NAME'", // TRANSLATORS: popup menu item // TRANSLATORS: kick player from guild _("Kick from guild")); @@ -506,9 +506,10 @@ void PopupMenu::showPlayerPopup(const std::string &nick) && guildManager->havePower())) #endif { - // TRANSLATORS: popup menu item - // TRANSLATORS: kick player from guild - mBrowserBox->addRow("guild-kick", _("Kick from guild")); + mBrowserBox->addRow("/kickguild 'NAME'", + // TRANSLATORS: popup menu item + // TRANSLATORS: kick player from guild + _("Kick from guild")); } if (guild2->getServerGuild()) { @@ -829,10 +830,10 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) && guildManager->havePower())) #endif { - // TRANSLATORS: popup menu item - // TRANSLATORS: kick player from guild - mBrowserBox->addRow(strprintf( - "@@guild-kick|%s@@", _("Kick from guild"))); + mBrowserBox->addRow("/kickguild 'NAME'", + // TRANSLATORS: popup menu item + // TRANSLATORS: kick player from guild + _("Kick from guild")); } if (guild2->getServerGuild()) { @@ -1067,22 +1068,6 @@ void PopupMenu::handleLink(const std::string &link, dialog->setActionEventId("ok"); dialog->addActionListener(&mPlayerListener); } - else if (link == "guild-kick" && !mNick.empty()) - { - if (localPlayer) - { - const Guild *const guild = localPlayer->getGuild(); - if (guild) - { - if (guild->getServerGuild()) - guildHandler->kick(guild->getMember(mNick), ""); -#ifdef TMWA_SUPPORT - else if (guildManager) - guildManager->kick(mNick); -#endif - } - } - } else if (link == "enable highlight" && mTab) { inputManager.executeChatCommand(InputAction::ENABLE_HIGHLIGHT, diff --git a/src/input/inputaction.h b/src/input/inputaction.h index 7b7a5e4cc..2eb89fc22 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -589,6 +589,7 @@ namespace InputAction HOMUN_EMOTE_46, HOMUN_EMOTE_47, HOMUN_EMOTE_48, + KICK_GUILD, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 33cfc942f..ae75d2b2d 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -4431,6 +4431,11 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputCondition::GAME, "", false}, + {"keyKickGuild", + defaultAction(&Actions::kickGuild), + InputCondition::INGAME, + "kickguild|guildkick", + true}, }; #undef defaultAction |