From f707c5eb3258491e336ff960258f4b8347631655 Mon Sep 17 00:00:00 2001 From: doitux Date: Fri, 21 Oct 2011 21:20:51 +0000 Subject: [PATCH] personal messages enhancements: complex nicks are automatic formated correctly with " " in the /msg command; also simple pm feedback for the sender added --- src/gui/qt/chattools/chattools.cpp | 19 +++++++++++++++---- src/gui/qt/settingsdialog.ui | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/gui/qt/chattools/chattools.cpp b/src/gui/qt/chattools/chattools.cpp index 2dafbb95..e906d9c4 100644 --- a/src/gui/qt/chattools/chattools.cpp +++ b/src/gui/qt/chattools/chattools.cpp @@ -50,8 +50,11 @@ void ChatTools::sendMessage() if(chatText.indexOf(QString("/msg ")) == 0) { chatText.remove(0, 5); unsigned playerId = parsePrivateMessageTarget(chatText); - if (playerId) + if (playerId) { mySession->sendPrivateChatMessage(playerId, chatText.toUtf8().constData()); + QString tmp = tr("private message sent to player: %1"); + myTextBrowser->append(""+tmp.arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerId).playerName.c_str()))+""); + } } else { mySession->sendLobbyChatMessage(chatText.toUtf8().constData()); } @@ -243,10 +246,18 @@ void ChatTools::nickAutoCompletition() // cout << nickAutoCompletitionCounter << "\n"; - if(lastChatString == "") + if(lastChatString == "") { myLineEdit->setText(lastMatchStringList.at(nickAutoCompletitionCounter)+": "); - else - myLineEdit->setText(lastChatString+" "+lastMatchStringList.at(nickAutoCompletitionCounter)+" "); + } + else { + //check if lastChatString is pm-code + if((lastChatString == "/msg" || lastChatString == "/msg ") && lastMatchStringList.at(nickAutoCompletitionCounter).contains(" ")) { + myLineEdit->setText(lastChatString+" \""+lastMatchStringList.at(nickAutoCompletitionCounter)+"\" "); + } + else { + myLineEdit->setText(lastChatString+" "+lastMatchStringList.at(nickAutoCompletitionCounter)+" "); + } + } nickAutoCompletitionCounter++; } diff --git a/src/gui/qt/settingsdialog.ui b/src/gui/qt/settingsdialog.ui index 15eacfab..821bc661 100644 --- a/src/gui/qt/settingsdialog.ui +++ b/src/gui/qt/settingsdialog.ui @@ -1554,7 +1554,7 @@ p, li { white-space: pre-wrap; } - 1 + 0