realtimenetprots/sipfw/ProfileAgent/IMS_Agent/Src/TSIPRegEventStateSubscribing.cpp
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     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        : TSIPRegEventStateSubscribing.cpp
       
    15 // Part of     : SIP Profile Agent
       
    16 // implementation
       
    17 // Version     : 1.0
       
    18 //
       
    19 
       
    20 
       
    21 
       
    22 #include "TSIPRegEventStateSubscribing.h"
       
    23 #include "sipregeventcontext.h"
       
    24 
       
    25 // ----------------------------------------------------------------------------
       
    26 // TSIPRegEventStateSubscribing::TSIPRegEventStateSubscribing
       
    27 // ----------------------------------------------------------------------------
       
    28 //
       
    29 TSIPRegEventStateSubscribing::TSIPRegEventStateSubscribing(
       
    30     MSIPRegEventContext& aContext)
       
    31     : TSIPRegEventSubscriptionStateBase(aContext)
       
    32     {
       
    33     }
       
    34 
       
    35 // ----------------------------------------------------------------------------
       
    36 // TSIPRegEventStateSubscribing::ResponseReceivedL
       
    37 // ----------------------------------------------------------------------------
       
    38 //		
       
    39 void TSIPRegEventStateSubscribing::ResponseReceivedL(
       
    40     TUint aStatusCode,
       
    41     TUint aRetryAfter)
       
    42     {
       
    43     if (aStatusCode >= 200)
       
    44         {
       
    45         if (aStatusCode < 300)
       
    46             {
       
    47             iContext.ChangeState(MSIPRegEventContext::ESubscribed);
       
    48             }
       
    49         else if (aStatusCode == 405 || 
       
    50                  aStatusCode == 482 || 
       
    51                  aStatusCode == 489)
       
    52             {
       
    53             iContext.ChangeState(MSIPRegEventContext::ENotSubscribed);
       
    54             iContext.RegEventNotSupportedByNetworkL();
       
    55             }
       
    56         else if (aStatusCode == 503)    
       
    57             {
       
    58             iContext.ChangeState(MSIPRegEventContext::ENotSubscribed);
       
    59             iContext.ReSubscribeAfterL(aRetryAfter);
       
    60             iContext.ChangeState(MSIPRegEventContext::EReSubscribing);
       
    61             }
       
    62         else
       
    63             {
       
    64             iContext.ChangeState(MSIPRegEventContext::ENotSubscribed);
       
    65             iContext.SubscriptionFailedL();
       
    66             }
       
    67         }
       
    68     }