personal messages enhancements: complex nicks are automatic formated

correctly with " " in the /msg command; also simple pm feedback for the
sender added
This commit is contained in:
doitux
2011-10-21 21:20:51 +00:00
parent 5b9a6c532c
commit f707c5eb32
2 changed files with 16 additions and 5 deletions
+15 -4
View File
@@ -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("<i>"+tmp.arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerId).playerName.c_str()))+"</i>");
}
} 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++;
}
+1 -1
View File
@@ -1554,7 +1554,7 @@ p, li { white-space: pre-wrap; }
<item row="2" column="0" colspan="2">
<widget class="QTabWidget" name="tabWidget_2">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab_2">
<attribute name="title">