multimediacommsengine/tsrc/testdriver/siptester/src/TCmdRemoveUserFromClientResolverCenRep.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 #include <centralrepository.h>
       
    19 #include "TCmdRemoveUserFromClientResolverCenRep.h"
       
    20 #include "SIPConstants.h"
       
    21 #include "CTcSIPContext.h"
       
    22 #include "sipclientresolverconfigcrkeys.h"
       
    23 
       
    24 /**
       
    25  * INPUT:
       
    26  *   Headers:		-
       
    27  *   Parameters:	ApplicationUid, ClientMatchType
       
    28  *   IDs:			-
       
    29  *
       
    30  * OUTPUT:
       
    31  *   Parameters:	-
       
    32  *   IDs:			-
       
    33  */
       
    34 void TCmdRemoveUserFromClientResolverCenRep::ExecuteL()
       
    35 	{
       
    36 	HBufC8* userNameBuf = ExtractHBufLC( KParamClientUserName );
       
    37 	TUid pluginUid = ExtractUidL( KParamPluginUid, ETrue );
       
    38 	TUid clientUid = ExtractUidL( KParamApplicationUid, ETrue );
       
    39 	
       
    40 	RArray<TUint32> keys;
       
    41     CleanupClosePushL(keys);
       
    42     TInt err = iContext.Repository().FindEqL(KSIPClientResolverUserNameMask,
       
    43                                 KSIPClientResolverFieldTypeMask,
       
    44                                 *userNameBuf,
       
    45                                 keys);
       
    46 
       
    47 	for (TInt i=0; !err && i < keys.Count(); i++)
       
    48         {
       
    49         TUint32 key = (KSIPClientResolverUserNameMask^(keys[i]));       
       
    50         // Read the related plug-in UID
       
    51         TUint32 uidKey = KSIPClientResolverPluginUIDMask|key;
       
    52         TInt uidValue(0);
       
    53         User::LeaveIfError(iContext.Repository().Get(uidKey,uidValue));
       
    54         TUid uid;
       
    55         uid.iUid = uidValue;
       
    56         // Read the related client UID
       
    57         TUint32 clientUidKey = KSIPClientResolverClientUIDMask|key;
       
    58         TInt clientUidValue(0);
       
    59         User::LeaveIfError(iContext.Repository().Get(clientUidKey,clientUidValue));
       
    60         TUid cuid;
       
    61         cuid.iUid = clientUidValue;
       
    62         
       
    63         if ( pluginUid == uid && clientUid == cuid )
       
    64         	{
       
    65         	iContext.Repository().Delete( clientUidKey );
       
    66         	iContext.Repository().Delete( uidKey );
       
    67         	iContext.Repository().Delete( KSIPClientResolverUserNameMask|key );
       
    68         	}
       
    69         }
       
    70     CleanupStack::PopAndDestroy(&keys);
       
    71     CleanupStack::PopAndDestroy( userNameBuf );
       
    72 	}
       
    73 
       
    74 // -----------------------------------------------------------------------------
       
    75 // TCmdRemoveUserFromClientResolverCenRep::Match
       
    76 // -----------------------------------------------------------------------------
       
    77 //	
       
    78 TBool TCmdRemoveUserFromClientResolverCenRep::Match( const TTcIdentifier& aId )
       
    79 	{
       
    80 	return TTcSIPCommandBase::Match( aId, _L8("RemoveUserFromClientResolverCenRep") );
       
    81 	}
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // TCmdRemoveUserFromClientResolverCenRep::CreateL
       
    85 // -----------------------------------------------------------------------------
       
    86 //	
       
    87 TTcCommandBase* TCmdRemoveUserFromClientResolverCenRep::CreateL( MTcTestContext& aContext )
       
    88 	{
       
    89 	return new( ELeave ) TCmdRemoveUserFromClientResolverCenRep( aContext );
       
    90 	}
       
    91