diff -r 2b7283837edb -r 3104fc151679 uiservicetab/vimpstcmdprocess/src/cvimpstcmddeletecontact.cpp --- a/uiservicetab/vimpstcmdprocess/src/cvimpstcmddeletecontact.cpp Thu Aug 19 09:41:53 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,188 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: command process for delete contact -* -*/ - - -// INCLUDE FILES -#include "cvimpstcmddeletecontact.h" - -#include "vimpstcmd.hrh" -#include "mvimpstcmdobserver.h" - -#include "uiservicetabtracer.h" - -#include -#include "mvimpstengine.h" -#include "cvimpststoragemanagerfactory.h" -#include "mvimpststorageserviceview.h" -#include "mvimpstenginesubservice.h" -#include "mvimpstenginecontactmgmtextention.h" -#include "mvimpstengineextentionfeatures.h" -#include "mvimpstengineimsubservice.h" -#include "tvimpstenums.h" -#include "tvimpstconsts.h" -#include "mvimpstenginesubservice.h" -#include "mvimpstenginepresencesubservice.h" -#include "mvimpstenginepresencesubservice.h" - -// Constants -_LIT( KListNameAllBuddy ,"buddylist" ); -_LIT( KPresenceBlockedList, "blockedcontacts"); - - -// -------------------------------------------------------------------------- -// CVIMPSTCmdDeleteContact::CVIMPSTCmdDeleteContact -// -------------------------------------------------------------------------- -// -CVIMPSTCmdDeleteContact::CVIMPSTCmdDeleteContact( - const TInt aCommandId , MVPbkContactLink* aContactLink, - MVIMPSTEngine& aEngine) : - iCommandId( aCommandId ), - iContactLink( aContactLink ), - iEngine(aEngine) - { - } - -// -------------------------------------------------------------------------- -// CVIMPSTCmdDeleteContact::~CVIMPSTCmdDeleteContact -// -------------------------------------------------------------------------- -// -CVIMPSTCmdDeleteContact::~CVIMPSTCmdDeleteContact() - { - - } - -// -------------------------------------------------------------------------- -// CVIMPSTCmdDeleteContact::NewL -// -------------------------------------------------------------------------- -// -CVIMPSTCmdDeleteContact* CVIMPSTCmdDeleteContact::NewL( - const TInt aCommandId, MVPbkContactLink* aContactLink, - MVIMPSTEngine& aEngine) - { - TRACER_AUTO; - CVIMPSTCmdDeleteContact* self = new (ELeave ) CVIMPSTCmdDeleteContact( aCommandId ,aContactLink, aEngine); - self->ConstructL(); //use contsurctL if necessary - return self; - } -// -------------------------------------------------------------------------- -// CVIMPSTCmdDeleteContact::ConstructL -// -------------------------------------------------------------------------- -// -void CVIMPSTCmdDeleteContact::ConstructL() - { - iError = KErrNone; - } - -// -------------------------------------------------------------------------- -// CVIMPSTCmdDeleteContact::ExecuteLD -// -------------------------------------------------------------------------- -// -void CVIMPSTCmdDeleteContact::ExecuteLD() - { - - TRACER_AUTO; - //push to the cleanupstack - CleanupStack::PushL( this ); - iError = KErrNone; - MVIMPSTStorageServiceView* storage = CVIMPSTStorageManagerFactory::ContactListInterfaceL( iEngine.ServiceId()) ; - if(storage) - { - MVIMPSTStorageContact* contact = storage->FindContactByLink( *iContactLink ); - if (contact ) - { - TBuf listId; - listId.Zero(); - listId.Append(KListNameAllBuddy); - if(TVIMPSTEnums::EBlocked == contact->OnlineStatus()) - { - listId.Zero(); - listId.Append(KPresenceBlockedList); - } - TPtrC userIdPtr = contact->UserId(); - MVIMPSTEngineSubService* subService = iEngine.SubService(TVIMPSTEnums::EPresence); - MVIMPSTEngineExtentionFeatures* feature = iEngine.ExtentionFeatures(TVIMPSTEnums::EContactManagement); - //Get IM SubService - MVIMPSTEngineSubService* imService = iEngine.SubService(TVIMPSTEnums::EIM) ; - //for each userid in the service details, unsubscribe - if( userIdPtr.Length() ) - { - if( subService ) - { - MVIMPSTEnginePresenceSubService& presenceSubService = MVIMPSTEnginePresenceSubService::Cast(*subService); - presenceSubService.UnSubscribePresenceOfSingleContactL( userIdPtr ); - } - if (feature ) - { - MVIMPSTEngineContactMgmtExtention& contactMgr = MVIMPSTEngineContactMgmtExtention::Cast(*feature); - TRAP(iError, contactMgr.DeleteServerContactL(listId, userIdPtr ) ); - } - if(imService ) - { - MVIMPSTEngineIMSubService& imSubService = - MVIMPSTEngineIMSubService::Cast (*imService); - TRAP_IGNORE( imSubService.CloseConversationL( userIdPtr )); - } - } - if( iError == KErrNone ) - { - storage->RemoveContactL( contact ); - } - } // contact - } // storage - - - if(iObserver) - { - iObserver->CommandFinishedL(*this); - } - - CleanupStack::PopAndDestroy(); - - } - - -// -------------------------------------------------------------------------- -// CVIMPSTCmdDeleteContact::AddObserver -// -------------------------------------------------------------------------- -// -void CVIMPSTCmdDeleteContact::AddObserver( MVIMPSTCmdObserver& aObserver ) - { - // store the observer to notify the command completion - iObserver = &aObserver; - } - - -// -------------------------------------------------------------------------- -// CVIMPSTCmdDeleteContact::CommandId -// -------------------------------------------------------------------------- -// -TInt CVIMPSTCmdDeleteContact::CommandId() const - { - return iCommandId; - } - -// -------------------------------------------------------------------------- -// CVIMPSTCmdDeleteContact::Result -// -------------------------------------------------------------------------- -// -TInt CVIMPSTCmdDeleteContact::Result() const - { - //return valid data regd the command operation - return iError; - } - -// End of File