realtimenetprots/sipfw/SIP/TransactionUser/src/StopUserAgent.cpp
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 // Copyright (c) 2006-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          : StopUserAgent.cpp
       
    15 // Part of       : TransactionUser
       
    16 // Version       : SIP/6.0
       
    17 //
       
    18 
       
    19 
       
    20 
       
    21 #include "SipAssert.h"
       
    22 #include "StopUserAgent.h"
       
    23 #include "CUserAgent.h"
       
    24 #include "CTransactionStore.h"
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // TStopUserAgent::TStopUserAgent
       
    28 // -----------------------------------------------------------------------------
       
    29 //
       
    30 TStopUserAgent::TStopUserAgent(TTransactionId aTransactionId,
       
    31                                CTransactionStore& aStore,
       
    32                                TInt aReason) :
       
    33     iTransactionId(aTransactionId),
       
    34     iStore(aStore),
       
    35     iReason(aReason)
       
    36     {
       
    37     }
       
    38 
       
    39 // -----------------------------------------------------------------------------
       
    40 // TStopUserAgent::CleanupItem
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 TCleanupItem TStopUserAgent::CleanupItem()
       
    44     {
       
    45     return TCleanupItem(StopIfFound, this);
       
    46     }
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // TStopUserAgent::StopIfFound
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 void TStopUserAgent::StopIfFound(TAny* aStopUserAgent)
       
    53     {
       
    54 	__SIP_ASSERT_RETURN(aStopUserAgent, KErrArgument);
       
    55 
       
    56     TStopUserAgent* s = reinterpret_cast<TStopUserAgent*>(aStopUserAgent);
       
    57     CUserAgent* ua = s->iStore.SearchById(s->iTransactionId);
       
    58     if (ua)
       
    59         {
       
    60         ua->Stop(s->iReason);
       
    61         }
       
    62 	}