Commit d880a06e6f1a00003c2eef7d70450a518faa8f7a

Authored by Imanol-Mikel Barba Sabariego
1 parent 0a21b29f

git-svn-id: svn://imanolbarba.net/PAD@42 c2ee353e-ed0d-4329-bf56-03aec153487f

QChatClient/QChatClient.pro.user
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject> 2 <!DOCTYPE QtCreatorProject>
3 -<!-- Written by QtCreator 2.7.1, 2013-12-27T07:19:09. --> 3 +<!-- Written by QtCreator 2.7.1, 2013-12-27T07:31:56. -->
4 <qtcreator> 4 <qtcreator>
5 <data> 5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable> 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
QChatClient/chatroom.cpp
@@ -200,18 +200,20 @@ void Chatroom::updateUserList(QString userlist) @@ -200,18 +200,20 @@ void Chatroom::updateUserList(QString userlist)
200 void Chatroom::relayMsg(string msg) 200 void Chatroom::relayMsg(string msg)
201 { 201 {
202 string sender = getSender(msg); 202 string sender = getSender(msg);
203 - //AT LEAST SOME FUCKING SANITY CHECK... PLEASE!!!  
204 - map<string,void*>::iterator it = activeChats.begin();  
205 - it = activeChats.find(sender);  
206 - if(it == activeChats.end()) 203 + if(!ui->userList->findItems(QString::fromStdString(sender),Qt::MatchExactly | Qt::MatchCaseSensitive).isEmpty())
207 { 204 {
208 - chatLock->lock();  
209 - emit createChat(QString::fromStdString(sender));  
210 - chatCreated.wait(*chatLock);  
211 - chatLock->unlock(); 205 + map<string,void*>::iterator it = activeChats.begin();
212 it = activeChats.find(sender); 206 it = activeChats.find(sender);
  207 + if(it == activeChats.end())
  208 + {
  209 + chatLock->lock();
  210 + emit createChat(QString::fromStdString(sender));
  211 + chatCreated.wait(*chatLock);
  212 + chatLock->unlock();
  213 + it = activeChats.find(sender);
  214 + }
  215 + ((ChatWindow*)it->second)->notifyPrint(msg);
213 } 216 }
214 - ((ChatWindow*)it->second)->notifyPrint(msg); //NOT GOOD!  
215 } 217 }
216 218
217 void Chatroom::newChat(QString peerNick) 219 void Chatroom::newChat(QString peerNick)
build-QChatClient-Desktop-Debug/QChatClient
No preview for this file type