Commit d880a06e6f1a00003c2eef7d70450a518faa8f7a
1 parent
0a21b29f
git-svn-id: svn://imanolbarba.net/PAD@42 c2ee353e-ed0d-4329-bf56-03aec153487f
Showing
3 changed files
with
12 additions
and
10 deletions
QChatClient/QChatClient.pro.user
QChatClient/chatroom.cpp
... | ... | @@ -200,18 +200,20 @@ void Chatroom::updateUserList(QString userlist) |
200 | 200 | void Chatroom::relayMsg(string msg) |
201 | 201 | { |
202 | 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 | 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 | 219 | void Chatroom::newChat(QString peerNick) | ... | ... |
build-QChatClient-Desktop-Debug/QChatClient
No preview for this file type