multimediacommsengine/tsrc/testdriver/siptester/src/TCmdRemoveAllUserFromClientResolverCenRep.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <centralrepository.h>
       
    20 #include "TCmdRemoveAllUserFromClientResolverCenRep.h"
       
    21 #include "SIPConstants.h"
       
    22 #include "CTcSIPContext.h"
       
    23 #include "sipclientresolverconfigcrkeys.h"
       
    24 
       
    25 /**
       
    26  * INPUT:
       
    27  *   Headers:		-
       
    28  *   Parameters:	ApplicationUid, ClientMatchType
       
    29  *   IDs:			-
       
    30  *
       
    31  * OUTPUT:
       
    32  *   Parameters:	-
       
    33  *   IDs:			-
       
    34  */
       
    35 void TCmdRemoveAllUserFromClientResolverCenRep::ExecuteL()
       
    36 	{
       
    37 	RArray<TUint32> keys;
       
    38     CleanupClosePushL(keys);
       
    39 	TInt err = iContext.Repository().FindL(KSIPClientResolverUserNameMask,
       
    40                                 KSIPClientResolverFieldTypeMask,
       
    41                                 keys);
       
    42 
       
    43 	for (TInt i=0; !err && i < keys.Count(); i++)
       
    44         {
       
    45         TUint32 key = (KSIPClientResolverUserNameMask^(keys[i]));       
       
    46         // Read the related plug-in UID
       
    47         TUint32 uidKey = KSIPClientResolverPluginUIDMask|key;
       
    48         TInt uidValue(0);
       
    49         User::LeaveIfError(iContext.Repository().Get(uidKey,uidValue));
       
    50         // Read the related client UID
       
    51         TUint32 clientUidKey = KSIPClientResolverClientUIDMask|key;
       
    52         TInt clientUidValue(0);
       
    53         User::LeaveIfError(iContext.Repository().Get(clientUidKey,clientUidValue));
       
    54         
       
    55         iContext.Repository().Delete( clientUidKey );
       
    56         iContext.Repository().Delete( uidKey );
       
    57         iContext.Repository().Delete( KSIPClientResolverUserNameMask|key );
       
    58         }
       
    59     CleanupStack::PopAndDestroy(&keys);
       
    60 	}
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // TCmdRemoveAllUserFromClientResolverCenRep::Match
       
    64 // -----------------------------------------------------------------------------
       
    65 //	
       
    66 TBool TCmdRemoveAllUserFromClientResolverCenRep::Match( const TTcIdentifier& aId )
       
    67 	{
       
    68 	return TTcSIPCommandBase::Match( aId, _L8("RemoveAllUserFromClientResolverCenRep") );
       
    69 	}
       
    70 
       
    71 // -----------------------------------------------------------------------------
       
    72 // TCmdRemoveAllUserFromClientResolverCenRep::CreateL
       
    73 // -----------------------------------------------------------------------------
       
    74 //	
       
    75 TTcCommandBase* TCmdRemoveAllUserFromClientResolverCenRep::CreateL( MTcTestContext& aContext )
       
    76 	{
       
    77 	return new( ELeave ) TCmdRemoveAllUserFromClientResolverCenRep( aContext );
       
    78 	}
       
    79