simpledatamodeladapter/src/presenceplugincontactstateresolve.cpp
changeset 0 c8caa15ef882
child 8 aca99fb8a3dd
equal deleted inserted replaced
-1:000000000000 0:c8caa15ef882
       
     1 /*
       
     2 * Copyright (c) 2010 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:  IETF SIMPLE Protocol implementation for XIMP Framework
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <mvpbkcontactlinkarray.h>
       
    20 #include <mvpbkcontactlink.h>
       
    21 #include "presenceplugincontactstateresolve.h"
       
    22 #include "presencecontactscontextbase.h"
       
    23 #include "presenceplugincontactstatehandler.h"
       
    24 
       
    25 
       
    26 // ======== MEMBER FUNCTIONS ========
       
    27 
       
    28 // ---------------------------------------------------------------------------
       
    29 // CPresencePluginContactStateResolve::PresencePluginContactStateResolve
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 CPresencePluginContactStateResolve::CPresencePluginContactStateResolve(
       
    33     MPresenceContactsContextBase& aContext,
       
    34     CPresencePluginContactStateHandler& aStateHandler )
       
    35     : CPresencepluginContactState( aContext, aStateHandler ),
       
    36       iContactLinkIndex( NULL ),
       
    37     iContactLinkCount( NULL )
       
    38     {
       
    39     }
       
    40 
       
    41 
       
    42 // ---------------------------------------------------------------------------
       
    43 // CPresencePluginContactStateResolve::~CPresencePluginContactStateResolve
       
    44 // ---------------------------------------------------------------------------
       
    45 //
       
    46 CPresencePluginContactStateResolve::~CPresencePluginContactStateResolve()
       
    47     {
       
    48     }
       
    49 
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // CPresencePluginContactStateResolve::HandleL
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 void CPresencePluginContactStateResolve::HandleL()
       
    56     {
       
    57     iContactLinkCount = iContext->ContactLinkArrayL().Count();
       
    58     if ( NULL == iContactLinkCount )
       
    59         {
       
    60         Error( KErrNotFound );
       
    61         }
       
    62     else
       
    63         {
       
    64         iContext->RetrieveContactL(
       
    65             iContext->ContactLinkArrayL().At( iContactLinkIndex ) );
       
    66         iContactLinkIndex++;
       
    67         }
       
    68     }
       
    69 
       
    70 
       
    71 // ---------------------------------------------------------------------------
       
    72 // CPresencePluginContactStateResolve::Complete
       
    73 // ---------------------------------------------------------------------------
       
    74 //
       
    75 void CPresencePluginContactStateResolve::Complete()
       
    76     {
       
    77     if ( iContactLinkIndex < iContactLinkCount )
       
    78         {
       
    79         TRAPD( error, HandleL() );
       
    80         if ( KErrNone != error )
       
    81             {
       
    82             Error( error );
       
    83             }
       
    84         }
       
    85     else
       
    86         {
       
    87         iStateHandler->ProgressToNextState();
       
    88         }
       
    89     }