From kde-commits Sun Feb 01 09:09:55 2004 From: Olivier Goffart Date: Sun, 01 Feb 2004 09:09:55 +0000 To: kde-commits Subject: kdenetwork/kopete/protocols/msn Message-Id: <20040201090955.ECEF79840 () office ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=107562661503609 CVS commit by ogoffart: Fix the KDE 3.2 showstopper Rob mentioned in the mailing list. The fact is that when the user ask to create a new socket to start a chat, kopete wanted to create a KMM, which itself create another new socket. Ok to backport to 3_2_BRANCH ? what should i do ? CCMAIL: kopete-devel@kde.org M +13 -3 msnaccount.cpp 1.62 --- kdenetwork/kopete/protocols/msn/msnaccount.cpp #1.61:1.62 @@ -960,5 +960,15 @@ void MSNAccount::slotCreateChat( const Q if ( c && myself() ) { - static_cast( c->manager( true ) )->createChat( handle, address, auth, ID ); + // we can't use simply c->manager(true) here to get the manager, because this will re-open + // another chat session, and then, close this new one. We have to re-create the manager manualy. + MSNMessageManager *manager = dynamic_cast( c->manager( false ) ); + if(!manager) + { + KopeteContactPtrList chatmembers; + chatmembers.append(c); + manager = new MSNMessageManager( protocol(), myself(), chatmembers ); + } + + manager->createChat( handle, address, auth, ID ); KGlobal::config()->setGroup( "MSN" ); @@ -968,6 +978,6 @@ void MSNAccount::slotCreateChat( const Q // this temporary message should open the window if they not exist QString body = i18n( "%1 has started a chat with you" ).arg( c->displayName() ); - KopeteMessage tmpMsg = KopeteMessage( c, c->manager()->members(), body, KopeteMessage::Internal, KopeteMessage::PlainText ); - c->manager()->appendMessage( tmpMsg ); + KopeteMessage tmpMsg = KopeteMessage( c, manager->members(), body, KopeteMessage::Internal, KopeteMessage::PlainText ); + manager->appendMessage( tmpMsg ); } }