bugfix for #221 (Beep when message from ignored player)

This commit is contained in:
doitux
2013-11-16 15:36:05 +01:00
parent 044553fddb
commit 827ce4fee1
2 changed files with 12 additions and 17 deletions
+11 -13
View File
@@ -92,22 +92,11 @@ void ChatTools::receiveMessage(QString playerName, QString message, bool pm)
QString tempMsg;
if(myChatType == INET_LOBBY_CHAT && playerName == "(chat bot)" && message.startsWith(myNick)) {
tempMsg = QString("<span style=\"font-weight:bold; color:red;\">"+message+"</span>");
//play beep sound only in INET-lobby-chat
if(myLobby->isVisible() && myConfig->readConfigInt("PlayLobbyChatNotification")) {
myLobby->getMyW()->getMySoundEventHandler()->playSound("lobbychatnotify",0);
}
} else if(message.contains(myNick, Qt::CaseInsensitive)) {
switch (myChatType) {
case INET_LOBBY_CHAT: {
tempMsg = QString("<span style=\"font-weight:bold; color:"+myLobby->palette().link().color().name()+";\">"+message+"</span>");
//play beep sound only in INET-lobby-chat
// TODO dont play when message is from yourself
if(myLobby->isVisible() && myConfig->readConfigInt("PlayLobbyChatNotification")) {
myLobby->getMyW()->getMySoundEventHandler()->playSound("lobbychatnotify",0);
}
}
break;
case LAN_LOBBY_CHAT:
@@ -157,15 +146,24 @@ void ChatTools::receiveMessage(QString playerName, QString message, bool pm)
}
bool nickFoundOnIgnoreList = false;
bool chatBotWarnNickFoundOnIgnoreList = false;
list<std::string>::iterator it1;
for(it1=ignoreList.begin(); it1 != ignoreList.end(); ++it1) {
if(playerName == QString::fromUtf8(it1->c_str())) {
nickFoundOnIgnoreList = true;
}
if(myChatType == INET_LOBBY_CHAT && playerName == "(chat bot)" && message.startsWith(QString::fromUtf8(it1->c_str()))) {
chatBotWarnNickFoundOnIgnoreList = true;
}
}
if(!nickFoundOnIgnoreList) {
if(!nickFoundOnIgnoreList && !chatBotWarnNickFoundOnIgnoreList) {
//play beep sound as notification
if(myChatType == INET_LOBBY_CHAT && message.contains(myNick, Qt::CaseInsensitive) && playerName != myNick) {
if(myLobby->isVisible() && myConfig->readConfigInt("PlayLobbyChatNotification")) {
myLobby->getMyW()->getMySoundEventHandler()->playSound("lobbychatnotify",0);
}
}
if(!myConfig->readConfigInt("DisableChatEmoticons")) {
tempMsg = checkForEmotes(tempMsg);
+1 -4
View File
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>225</width>
<width>239</width>
<height>271</height>
</rect>
</property>
@@ -78,9 +78,6 @@
<string>Blinds</string>
</property>
<layout class="QGridLayout">
<property name="topMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QRadioButton" name="radioButton_useSavedBlindsSettings">
<property name="text">