|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Name : RestoreUaState.cpp |
|
15 // Part of : TransactionUser |
|
16 // Version : SIP/4.0 |
|
17 // |
|
18 |
|
19 |
|
20 |
|
21 #include "SipAssert.h" |
|
22 #include "RestoreUaState.h" |
|
23 #include "CUserAgent.h" |
|
24 |
|
25 // ----------------------------------------------------------------------------- |
|
26 // TRestoreUaState::TRestoreUaState |
|
27 // Either both aUserAgent and aTimer must be defined, or neither can. |
|
28 // ----------------------------------------------------------------------------- |
|
29 // |
|
30 TRestoreUaState::TRestoreUaState(TBool& aFinalRespPassed, |
|
31 CUserAgent* aUserAgent, |
|
32 CUserAgentTimer* aTimer) : |
|
33 iFinalRespPassed(aFinalRespPassed), |
|
34 iOriginalValue(iFinalRespPassed), |
|
35 iUserAgent(aUserAgent), |
|
36 iTimer(aTimer) |
|
37 { |
|
38 __ASSERT_DEBUG((aUserAgent && aTimer) || (!aUserAgent && !aTimer), |
|
39 User::Panic(_L("TRestoreUaState::TRestoreUaState() UA/timer mismatch"), |
|
40 KErrArgument)); |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // TRestoreUaState::CleanupItem |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 TCleanupItem TRestoreUaState::CleanupItem() |
|
48 { |
|
49 return TCleanupItem(Restore, this); |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // TRestoreUaState::Restore |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 void TRestoreUaState::Restore(TAny* aRestoreState) |
|
57 { |
|
58 __SIP_ASSERT_RETURN(aRestoreState, KErrArgument); |
|
59 |
|
60 TRestoreUaState* restore = |
|
61 reinterpret_cast<TRestoreUaState*>(aRestoreState); |
|
62 |
|
63 restore->iFinalRespPassed = restore->iOriginalValue; |
|
64 |
|
65 if (restore->iUserAgent && restore->iTimer) |
|
66 { |
|
67 restore->iUserAgent->DeleteTimer(*restore->iTimer); |
|
68 } |
|
69 } |