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