From a348d4a8882300fa308d210e860dd29a4b974622 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 19 Aug 2016 22:01:05 +0300 Subject: Use input manager for most commands in party tab. --- src/gui/widgets/tabs/chat/partytab.cpp | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'src/gui/widgets/tabs/chat/partytab.cpp') diff --git a/src/gui/widgets/tabs/chat/partytab.cpp b/src/gui/widgets/tabs/chat/partytab.cpp index 10104cd63..3786e916b 100644 --- a/src/gui/widgets/tabs/chat/partytab.cpp +++ b/src/gui/widgets/tabs/chat/partytab.cpp @@ -30,11 +30,13 @@ #include "const/sound.h" +#include "gui/windows/chatwindow.h" + +#include "input/inputmanager.h" + #include "net/partyhandler.h" #include "net/serverfeatures.h" -#include "gui/windows/chatwindow.h" - #include "utils/booleanoptions.h" #include "debug.h" @@ -64,29 +66,21 @@ void PartyTab::handleInput(const std::string &msg) bool PartyTab::handleCommand(const std::string &restrict type, const std::string &restrict args) { - if (type == "create" || type == "new") - { - if (args.empty()) - { - // TRANSLATORS: chat error message - chatLog(_("Party name is missing."), ChatMsgType::BY_SERVER); - } - else - { - partyHandler->create(args); - } - } - else if (type == "invite") + if (type == "invite") { partyHandler->invite(args); } else if (type == "leave") { - partyHandler->leave(); + inputManager.executeChatCommand(InputAction::LEAVE_PARTY, + args, + this); } else if (type == "kick") { - partyHandler->kick(args); + inputManager.executeChatCommand(InputAction::KICK_PARTY, + args, + this); } else if (type == "item") { @@ -193,7 +187,10 @@ bool PartyTab::handleCommand(const std::string &restrict type, else if (type == "setleader" && serverFeatures->haveChangePartyLeader()) { - partyHandler->changeLeader(args); + inputManager.executeChatCommand( + InputAction::COMMAND_CHANGE_PARTY_LEADER, + args, + this); } else { -- cgit v1.2.3-70-g09d2