diff -r 000000000000 -r 307788aac0a8 realtimenetprots/sipfw/SIP/TransactionUser/src/RestoreUaState.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/realtimenetprots/sipfw/SIP/TransactionUser/src/RestoreUaState.cpp Tue Feb 02 01:03:15 2010 +0200 @@ -0,0 +1,69 @@ +// Copyright (c) 2005-2009 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: +// Name : RestoreUaState.cpp +// Part of : TransactionUser +// Version : SIP/4.0 +// + + + +#include "SipAssert.h" +#include "RestoreUaState.h" +#include "CUserAgent.h" + +// ----------------------------------------------------------------------------- +// TRestoreUaState::TRestoreUaState +// Either both aUserAgent and aTimer must be defined, or neither can. +// ----------------------------------------------------------------------------- +// +TRestoreUaState::TRestoreUaState(TBool& aFinalRespPassed, + CUserAgent* aUserAgent, + CUserAgentTimer* aTimer) : + iFinalRespPassed(aFinalRespPassed), + iOriginalValue(iFinalRespPassed), + iUserAgent(aUserAgent), + iTimer(aTimer) + { + __ASSERT_DEBUG((aUserAgent && aTimer) || (!aUserAgent && !aTimer), + User::Panic(_L("TRestoreUaState::TRestoreUaState() UA/timer mismatch"), + KErrArgument)); + } + +// ----------------------------------------------------------------------------- +// TRestoreUaState::CleanupItem +// ----------------------------------------------------------------------------- +// +TCleanupItem TRestoreUaState::CleanupItem() + { + return TCleanupItem(Restore, this); + } + +// ----------------------------------------------------------------------------- +// TRestoreUaState::Restore +// ----------------------------------------------------------------------------- +// +void TRestoreUaState::Restore(TAny* aRestoreState) + { + __SIP_ASSERT_RETURN(aRestoreState, KErrArgument); + + TRestoreUaState* restore = + reinterpret_cast(aRestoreState); + + restore->iFinalRespPassed = restore->iOriginalValue; + + if (restore->iUserAgent && restore->iTimer) + { + restore->iUserAgent->DeleteTimer(*restore->iTimer); + } + }