From kde-commits Sun May 01 16:53:47 2005 From: Olivier Goffart Date: Sun, 01 May 2005 16:53:47 +0000 To: kde-commits Subject: kdenetwork/kopete/protocols/msn Message-Id: <20050501165347.54E5F4A6 () office ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=111496645316076 CVS commit by ogoffart: Force to close every open chat when we are connected with another client. Bug: 103939 M +18 -4 msnaccount.cpp 1.121 --- kdenetwork/kopete/protocols/msn/msnaccount.cpp #1.120:1.121 @@ -41,4 +41,5 @@ #include "kopeteuiglobal.h" #include "kopeteglobal.h" +#include "kopetemessagemanagerfactory.h" #include "contactaddednotifydialog.h" @@ -394,8 +395,4 @@ void MSNAccount::slotNotifySocketStatusC */ - setAllContactsStatus( MSNProtocol::protocol()->FLN ); - // FIXME: give correct disconnect reason - disconnected( Manual ); - /* m_allowList.clear(); @@ -429,6 +426,23 @@ void MSNAccount::slotNotifySocketClosed( m_notifySocket = 0l; myself()->setOnlineStatus( MSNProtocol::protocol()->FLN ); + setAllContactsStatus( MSNProtocol::protocol()->FLN ); disconnected(reason); + + if(reason == Kopete::Account::OtherClient) + { //close all chat sessions, so new message will arive to the other client. + + QValueList sessions = Kopete::ChatSessionManager::self()->sessions(); + QValueList::Iterator it; + for (it=sessions.begin() ; it != sessions.end() ; it++ ) + { + MSNChatSession *msnCS = dynamic_cast( *it ); + if ( msnCS && msnCS->account() == this ) + { + msnCS->slotCloseSession(); + } + } + } + #if 0 else if ( state == 0x10 ) // connection died unexpectedly