ximpfw/presence/srcpresenceoperations/presencewatching/operationhandlepresentitypresence.cpp
changeset 0 e6b17d312c8b
equal deleted inserted replaced
-1:000000000000 0:e6b17d312c8b
       
     1 /*
       
     2 * Copyright (c) 2006 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:  implementation of COperationHandlePresentityPresence
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #include "operationhandlepresentitypresence.h"
       
    20 #include "presenceinfoimp.h"
       
    21 #include "ximpobjecthelpers.h"
       
    22 #include "presencedatacacheimp.h"
       
    23 #include "ximpidentityimp.h"
       
    24 #include "presentitypresencesubscriptionitem.h"
       
    25 #include "ximphost.h"
       
    26 
       
    27 #include "ximprestrictedobjectcollectionimp.h"
       
    28 #include "protocolpresencedatahostimp.h"
       
    29 
       
    30 #include "ximptrace.h"
       
    31 // ============================ MEMBER FUNCTIONS =============================
       
    32 
       
    33 // ---------------------------------------------------------------------------
       
    34 // COperationHandlePresentityPresence::~COperationHandlePresentityPresence()
       
    35 // ---------------------------------------------------------------------------
       
    36 //
       
    37 COperationHandlePresentityPresence::~COperationHandlePresentityPresence()
       
    38     {
       
    39     delete iIdentity;
       
    40     delete iPresenceInfo;
       
    41     }
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // COperationHandlePresentityPresence::COperationHandlePresentityPresence()
       
    45 // ---------------------------------------------------------------------------
       
    46 //
       
    47 EXPORT_C COperationHandlePresentityPresence::COperationHandlePresentityPresence( TInt aOperation )
       
    48 : iOperation( aOperation )
       
    49     {
       
    50     }
       
    51 
       
    52 // ---------------------------------------------------------------------------
       
    53 // COperationHandlePresentityPresence::ConstructL()
       
    54 // ---------------------------------------------------------------------------
       
    55 //
       
    56 void COperationHandlePresentityPresence::ConstructL( const TDesC8& /* aParamPck */ )
       
    57     {
       
    58     }
       
    59 
       
    60 
       
    61 // ---------------------------------------------------------------------------
       
    62 // COperationHandlePresentityPresence::ProcessL()
       
    63 // ---------------------------------------------------------------------------
       
    64 //
       
    65 void COperationHandlePresentityPresence::ProcessL()
       
    66     {
       
    67     TRACE(_L("COperationHandlePresentityPresence::ProcessL()") );
       
    68     CXIMPOperationBase::ProcessL();
       
    69 
       
    70     MXIMPBase* object = NULL;
       
    71     iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId );
       
    72     if ( object )
       
    73         {
       
    74         iIdentity = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object );
       
    75         }
       
    76     else
       
    77         {
       
    78         User::Leave( KErrArgument );
       
    79         }
       
    80     object = NULL;
       
    81     iObjCollection->GetByType( object, MPresenceInfo::KInterfaceId );
       
    82     if( object )
       
    83         {
       
    84         iPresenceInfo = TXIMPGetImpClassOrPanic< CPresenceInfoImp >::From( *object );
       
    85         }
       
    86     else
       
    87         {
       
    88         User::Leave( KErrArgument );
       
    89         }
       
    90     
       
    91     CPresentityPresenceSubscriptionItem& presenceItem = 
       
    92         iMyHost->PresenceDataAccess().PresenceDataCache().PresentityPresenceSubscriptionItemLC( *iIdentity );
       
    93     presenceItem.SetPresenceInfoL( iPresenceInfo );        
       
    94     iPresenceInfo = NULL;
       
    95     
       
    96     if( iOperation == NPresenceOps::EPrHandlePresentityPresenceTerminated )
       
    97         {
       
    98         //presenceItem.SetSubscriptionState( MPresenceInfo::EDataSubscriptionTerminated );
       
    99         }
       
   100     
       
   101     TRAPD( err, presenceItem.SynthesiseSubscriptionEventToAllCtxsL() );
       
   102     CleanupStack::PopAndDestroy(); // presenceItem
       
   103     iMyHost->HandleAdaptationRequestCompleted( iReqId, err );
       
   104     }
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 // COperationHandlePresentityPresence::RequestCompleted()
       
   108 // ---------------------------------------------------------------------------
       
   109 //
       
   110 void COperationHandlePresentityPresence::RequestCompletedL()
       
   111     {
       
   112     TRACE(_L("COperationHandlePresentityPresence::RequestCompletedL()" ) );
       
   113     CXIMPOperationBase::RequestCompletedL();    
       
   114     // no special handling for error situations
       
   115     }
       
   116 
       
   117 
       
   118 // ---------------------------------------------------------------------------
       
   119 // COperationHandlePresentityPresence::Type()
       
   120 // ---------------------------------------------------------------------------
       
   121 //
       
   122 TInt COperationHandlePresentityPresence::Type() const
       
   123     {
       
   124     return ( TInt) iOperation;
       
   125     }
       
   126 
       
   127 // End of file