diff --git a/QChatClient/QChatClient.pro.user b/QChatClient/QChatClient.pro.user index 1434025..6d9b420 100644 --- a/QChatClient/QChatClient.pro.user +++ b/QChatClient/QChatClient.pro.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget diff --git a/QChatClient/chatroom.cpp b/QChatClient/chatroom.cpp index 9a9b4b6..f23cb74 100644 --- a/QChatClient/chatroom.cpp +++ b/QChatClient/chatroom.cpp @@ -200,18 +200,20 @@ void Chatroom::updateUserList(QString userlist) void Chatroom::relayMsg(string msg) { string sender = getSender(msg); - //AT LEAST SOME FUCKING SANITY CHECK... PLEASE!!! - map::iterator it = activeChats.begin(); - it = activeChats.find(sender); - if(it == activeChats.end()) + if(!ui->userList->findItems(QString::fromStdString(sender),Qt::MatchExactly | Qt::MatchCaseSensitive).isEmpty()) { - chatLock->lock(); - emit createChat(QString::fromStdString(sender)); - chatCreated.wait(*chatLock); - chatLock->unlock(); + map::iterator it = activeChats.begin(); it = activeChats.find(sender); + if(it == activeChats.end()) + { + chatLock->lock(); + emit createChat(QString::fromStdString(sender)); + chatCreated.wait(*chatLock); + chatLock->unlock(); + it = activeChats.find(sender); + } + ((ChatWindow*)it->second)->notifyPrint(msg); } - ((ChatWindow*)it->second)->notifyPrint(msg); //NOT GOOD! } void Chatroom::newChat(QString peerNick) diff --git a/build-QChatClient-Desktop-Debug/QChatClient b/build-QChatClient-Desktop-Debug/QChatClient index 578e66e..20ab739 100755 --- a/build-QChatClient-Desktop-Debug/QChatClient +++ b/build-QChatClient-Desktop-Debug/QChatClient