diff --git a/src/gui/qt/mainwindow/chat/chat.cpp b/src/gui/qt/mainwindow/chat/chat.cpp index 93c04841..401b531d 100644 --- a/src/gui/qt/mainwindow/chat/chat.cpp +++ b/src/gui/qt/mainwindow/chat/chat.cpp @@ -21,6 +21,8 @@ #include "mainwindowimpl.h" #include "session.h" +#include "game.h" +#include "playerinterface.h" #include "chattools.h" #include "configfile.h" @@ -40,6 +42,26 @@ Chat::~Chat() void Chat::sendMessage() { + //filter /kick commando + if(myW->lineEdit_ChatInput->text().startsWith("/kick")) { + QString playerToKick = myW->lineEdit_ChatInput->text().section(" ",1,1); + + myW->lineEdit_ChatInput->setText(""); + if(myW->getSession().getClientGameInfo(myW->getSession().getCurrentGame()->getMyGameID()).adminPlayerId == myW->getSession().getCurrentGame()->getSeatsList()->front()->getMyUniqueID()) { + + if(playerToKick.toUtf8().constData() == myW->getSession().getCurrentGame()->getSeatsList()->front()->getMyName()) { + myW->textBrowser_Chat->append(""+tr("You cannot kick yourself!")+""); + } + else { + myW->getSession().kickPlayer(playerToKick.toUtf8().constData()); + } + } + else { + myW->textBrowser_Chat->append(""+tr("You cannot kick any player - You are not game admin!")+""); + } + return; + } + fillChatLinesHistory(myW->lineEdit_ChatInput->text()); myW->getSession().sendChatMessage(myW->lineEdit_ChatInput->text().toUtf8().constData()); myW->lineEdit_ChatInput->setText("");