From kde-commits Tue Jul 19 12:41:23 2005 From: Will Stephenson Date: Tue, 19 Jul 2005 12:41:23 +0000 To: kde-commits Subject: KDE/kdenetwork/kopete/protocols/groupwise Message-Id: <1121776883.486928.15480.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=112177698115787 SVN commit 436264 by wstephens: GroupWise: Fix crash when using 'Add to Contact List' on a stranger who has messaged you, and remove an unnecessary contact name change following the add on the server. M +13 -9 gwaccount.cpp --- trunk/KDE/kdenetwork/kopete/protocols/groupwise/gwaccount.cpp #436263:436264 @@ -450,7 +450,6 @@ void GroupWiseAccount::slotLoggedIn() { - kdDebug ( GROUPWISE_DEBUG_GLOBAL ) << k_funcinfo << endl; reconcileOfflineChanges(); myself()->setOnlineStatus( protocol()->groupwiseAvailable ); @@ -461,6 +460,7 @@ void GroupWiseAccount::reconcileOfflineChanges() { + kdDebug ( GROUPWISE_DEBUG_GLOBAL ) << k_funcinfo << endl; m_dontSync = true; //sanity check the server side model vs our contact list. //Contacts might have been removed from some groups or entirely on the server. @@ -1501,20 +1501,24 @@ candidateGrp = grpIt; ++grpIt; GWFolder * destinationFolder = m_serverListModel->findFolderByName( ( ( *candidateGrp )->displayName() ) ); - Q_ASSERT( destinationFolder ); // might not exist on the server yet - kdDebug( GROUPWISE_DEBUG_GLOBAL ) << " - add a contact instance for group '" << destinationFolder->displayName << "'" << endl; - CreateContactInstanceTask * ccit = new CreateContactInstanceTask( client()->rootTask() ); - QObject::connect( ccit, SIGNAL( gotContactDeleted( const ContactItem & ) ), SLOT( receiveContactDeleted( const ContactItem & ) ) ); + contact->setNickName( contact->metaContact()->displayName() ); // does this group exist on the server? Create the contact appropriately - int parentId = destinationFolder->id; - if ( true ) + if ( destinationFolder ) + { + int parentId = destinationFolder->id; ccit->contactFromUserId( contact->dn(), contact->metaContact()->displayName(), parentId ); + } else { - // discover the next free sequence number and add the group using that - ccit->contactFromUserIdAndFolder( contact->dn(), contact->metaContact()->displayName(), nextFreeSequence++, ( *candidateGrp )->displayName() ); + if ( ( *candidateGrp ) == Kopete::Group::topLevel() ) + ccit->contactFromUserId( contact->dn(), contact->metaContact()->displayName(), + m_serverListModel->rootFolder->id ); + else + // discover the next free sequence number and add the group using that + ccit->contactFromUserIdAndFolder( contact->dn(), contact->metaContact()->displayName(), + nextFreeSequence++, ( *candidateGrp )->displayName() ); } ccit->go( true ); groupList.remove( candidateGrp );