Commit 1ed92128185eaa72910e77a9196413e2b59d0b50

Authored by Imanol-Mikel Barba Sabariego
1 parent 943f372e

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

Showing 1 changed file with 3 additions and 0 deletions
QChatClient/chatroom.cpp
@@ -233,6 +233,7 @@ void Chatroom::relayMsg(string msg) @@ -233,6 +233,7 @@ void Chatroom::relayMsg(string msg)
233 233
234 void Chatroom::newChat(QString peerNick) 234 void Chatroom::newChat(QString peerNick)
235 { 235 {
  236 + cout << "add chat" << endl;
236 freeChats(false); 237 freeChats(false);
237 ChatWindow* newchat = new ChatWindow(peerNick,this); 238 ChatWindow* newchat = new ChatWindow(peerNick,this);
238 activeChats.insert(std::pair<string,ChatWindow*>(peerNick.toStdString(),newchat)); 239 activeChats.insert(std::pair<string,ChatWindow*>(peerNick.toStdString(),newchat));
@@ -242,6 +243,7 @@ void Chatroom::newChat(QString peerNick) @@ -242,6 +243,7 @@ void Chatroom::newChat(QString peerNick)
242 243
243 void Chatroom::removeChat(QString &nickname) 244 void Chatroom::removeChat(QString &nickname)
244 { 245 {
  246 + cout << "move to inactive" << endl;
245 chatMutex.lock(); 247 chatMutex.lock();
246 ChatWindow* chat = (ChatWindow*) activeChats.find(nickname.toStdString())->second; 248 ChatWindow* chat = (ChatWindow*) activeChats.find(nickname.toStdString())->second;
247 inactiveChats.insert(std::pair<string,ChatWindow*>(nickname.toStdString(),chat)); 249 inactiveChats.insert(std::pair<string,ChatWindow*>(nickname.toStdString(),chat));
@@ -397,6 +399,7 @@ void Chatroom::freeChats(bool active) @@ -397,6 +399,7 @@ void Chatroom::freeChats(bool active)
397 { 399 {
398 for(it = inactiveChats.begin(); it != inactiveChats.end(); it++) 400 for(it = inactiveChats.begin(); it != inactiveChats.end(); it++)
399 { 401 {
  402 + cout << "delete from inactive" << endl;
400 ChatWindow* chat = (ChatWindow*) it->second; 403 ChatWindow* chat = (ChatWindow*) it->second;
401 delete chat; 404 delete chat;
402 } 405 }