From 8485db5ade8f638420296d3e91ebfc790fac3c32 Mon Sep 17 00:00:00 2001 From: lotodore Date: Mon, 10 Dec 2007 19:59:11 +0000 Subject: [PATCH] Fixed kicking players with spaces in their name from within a game. --- src/gui/qt/mainwindow/chat/chat.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gui/qt/mainwindow/chat/chat.cpp b/src/gui/qt/mainwindow/chat/chat.cpp index 71553ace..1f03372c 100644 --- a/src/gui/qt/mainwindow/chat/chat.cpp +++ b/src/gui/qt/mainwindow/chat/chat.cpp @@ -28,6 +28,8 @@ using namespace std; +#define COMMAND_KICK_STR "/kick " + Chat::Chat(mainWindowImpl* w, ConfigFile *c) : myW(w), myConfig(c) { myChatTools = new ChatTools(myW->lineEdit_ChatInput, myConfig, 2, myW->textBrowser_Chat); @@ -42,10 +44,11 @@ Chat::~Chat() void Chat::sendMessage() { - //filter /kick commando - if(myW->lineEdit_ChatInput->text().startsWith("/kick")) { - QString playerToKick = myW->lineEdit_ChatInput->text().section(" ",1,1); - + //filter /kick command + if(myW->lineEdit_ChatInput->text().startsWith(COMMAND_KICK_STR)) { + QString playerToKick = myW->lineEdit_ChatInput->text(); + playerToKick.remove(0, sizeof(COMMAND_KICK_STR) - 1); + myW->lineEdit_ChatInput->setText(""); if(myW->getSession().getClientGameInfo(myW->getSession().getClientCurrentGameId()).adminPlayerId == myW->getSession().getCurrentGame()->getSeatsList()->front()->getMyUniqueID()) {