|
1 /* |
|
2 * Copyright (c) 2006 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 <unsafprotocolscrkeys.h> |
|
21 #include "CTcSIPContext.h" |
|
22 #include "TCmdEnableCRLFRefresh.h" |
|
23 #include "SIPConstants.h" |
|
24 |
|
25 |
|
26 /** |
|
27 * If KParamUNSAFEnableCRLFRefresh is not given, then the configured value is |
|
28 * removed from the repository. |
|
29 * |
|
30 * INPUT: |
|
31 * Headers: - |
|
32 * Parameters: KParamDomainName, KParamUNSAFEnableCRLFRefresh |
|
33 * IDs: - |
|
34 * |
|
35 * OUTPUT: |
|
36 * Parameters: - |
|
37 * IDs: - |
|
38 */ |
|
39 void TCmdEnableCRLFRefresh::ExecuteL() |
|
40 { |
|
41 TPtrC8 proxy = ExtractTextL( KParamDomainName, ETrue ); |
|
42 TBool disable( EFalse ); |
|
43 TRAPD( err, disable = ExtractBooleanL( KParamUNSAFEnableCRLFRefresh, |
|
44 ETrue ) ); |
|
45 __ASSERT_ALWAYS( err == KErrNone || err == KTcErrMandatoryParameterNotFound, |
|
46 User::Leave( err ) ); |
|
47 |
|
48 CRepository* repository = CRepository::NewLC( KCRUidUNSAFProtocols ); |
|
49 TUint32 key( 0 ); |
|
50 TInt status = FindDomainKeyL( *repository, proxy, key ); |
|
51 __ASSERT_ALWAYS( status == KErrNone || status == KErrNotFound, |
|
52 User::Leave( status ) ); |
|
53 |
|
54 User::LeaveIfError( |
|
55 repository->StartTransaction( |
|
56 CRepository::EConcurrentReadWriteTransaction ) ); |
|
57 repository->CleanupCancelTransactionPushL(); |
|
58 |
|
59 if ( err == KErrNone ) |
|
60 { |
|
61 if ( status == KErrNotFound ) |
|
62 { |
|
63 key = CreateNewKeyL( *repository, |
|
64 KUNSAFProtocolsDomainMask, |
|
65 KUNSAFProtocolsDomainTableMask ); |
|
66 WriteL( *repository, KUNSAFProtocolsDomainMask | key, proxy ); |
|
67 } |
|
68 |
|
69 const TInt KDisable = 1; |
|
70 const TInt KEnable = 0; |
|
71 WriteL( *repository, |
|
72 KUNSAFProtocolsDomainEnableCRLFRefresh | key, |
|
73 disable ? KDisable : KEnable ); |
|
74 } |
|
75 else |
|
76 { |
|
77 if ( status == KErrNone ) |
|
78 { |
|
79 RemoveParameterL( *repository, |
|
80 KUNSAFProtocolsDomainEnableCRLFRefresh | key ); |
|
81 } |
|
82 } |
|
83 |
|
84 TUint32 dummy( 0 ); |
|
85 User::LeaveIfError( repository->CommitTransaction( dummy ) ); |
|
86 CleanupStack::Pop( 1 ); // transaction |
|
87 |
|
88 CleanupStack::PopAndDestroy( repository ); |
|
89 } |
|
90 |
|
91 TBool TCmdEnableCRLFRefresh::Match( const TTcIdentifier& aId ) |
|
92 { |
|
93 return TTcSIPCommandBase::Match( aId, _L8("EnableCRLFRefresh") ); |
|
94 } |
|
95 |
|
96 TTcCommandBase* TCmdEnableCRLFRefresh::CreateL( MTcTestContext& aContext ) |
|
97 { |
|
98 return new( ELeave ) TCmdEnableCRLFRefresh( aContext ); |
|
99 } |