ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberremoved.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:  Handle presentity group content operations
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #include "operationhandlepresentitygroupmemberremoved.h"
       
    20 #include "ximpobjecthelpers.h"
       
    21 #include "groupcontentsubscriptionitem.h"
       
    22 #include "presencedatacacheimp.h"
       
    23 #include "presentitygroupmemberinfoimp.h"
       
    24 #include "ximpidentityimp.h"
       
    25 #include "ximphost.h"
       
    26 #include "ximpstatusimp.h"
       
    27 #include "ximprestrictedobjectcollectionimp.h"
       
    28 #include "protocolpresencedatahostimp.h"
       
    29 
       
    30 #include "ximptrace.h"
       
    31 
       
    32 // ============================ MEMBER FUNCTIONS =============================
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // COperationHandlePresentityGroupMemberRemoved::~COperationHandlePresentityGroupMemberRemoved()
       
    36 // ---------------------------------------------------------------------------
       
    37 //
       
    38 COperationHandlePresentityGroupMemberRemoved::~COperationHandlePresentityGroupMemberRemoved()
       
    39     {
       
    40     delete iMemberInfo;
       
    41     delete iGroupId;
       
    42     }
       
    43 
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // COperationHandlePresentityGroupMemberRemoved::COperationHandlePresentityGroupMemberRemoved()
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 EXPORT_C COperationHandlePresentityGroupMemberRemoved::COperationHandlePresentityGroupMemberRemoved()
       
    50     {
       
    51     }
       
    52 
       
    53 
       
    54 // ---------------------------------------------------------------------------
       
    55 // COperationHandlePresentityGroupMemberRemoved::ConstructL()
       
    56 // ---------------------------------------------------------------------------
       
    57 //
       
    58 void COperationHandlePresentityGroupMemberRemoved::ConstructL( const TDesC8& /*aParamPck*/ )
       
    59     {
       
    60     }
       
    61 
       
    62 
       
    63 // ---------------------------------------------------------------------------
       
    64 // COperationHandlePresentityGroupMemberRemoved::ProcessL()
       
    65 // ---------------------------------------------------------------------------
       
    66 //
       
    67 void COperationHandlePresentityGroupMemberRemoved::ProcessL()
       
    68     {
       
    69     TRACE(_L("COperationHandlePresentityGroupMemberRemoved::ProcessL()") );
       
    70     CXIMPOperationBase::ProcessL();
       
    71 
       
    72     MXIMPBase* object = NULL;
       
    73     iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId );
       
    74     if( object )
       
    75         {
       
    76         iGroupId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object );        
       
    77         }
       
    78     else
       
    79         {
       
    80         User::Leave( KErrArgument );
       
    81         }
       
    82         
       
    83     object = NULL;
       
    84     iObjCollection->GetByType( object, MPresentityGroupMemberInfo::KInterfaceId );
       
    85     if( object )
       
    86         {
       
    87         iMemberInfo = TXIMPGetImpClassOrPanic< CPresentityGroupMemberInfoImp >::From( *object );
       
    88         }
       
    89     else
       
    90         {
       
    91         User::Leave( KErrArgument );
       
    92         }
       
    93 
       
    94     if ( iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemExists( *iGroupId ) )
       
    95         {
       
    96         CGroupContentSubscriptionItem& subItem =
       
    97         iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemLC( *iGroupId );
       
    98 
       
    99         if ( subItem.GroupMemberExistsL( *iMemberInfo ) )
       
   100             {
       
   101             // clean out temporary lists
       
   102             subItem.Clean();
       
   103 
       
   104             RPrGrpMemInfoImpArray* removed = new ( ELeave ) RPrGrpMemInfoImpArray;
       
   105             CleanupStack::PushL( removed );
       
   106             removed->AppendL( iMemberInfo );
       
   107             iMemberInfo = NULL;
       
   108             subItem.SetRemovedListL( removed );
       
   109             CleanupStack::Pop( removed ); // ownership was transferred
       
   110 
       
   111             // synthesize the event to all contexts
       
   112             TRAP_IGNORE( subItem.SynthesiseSubscriptionEventToAllCtxsL() );
       
   113             }
       
   114         CleanupStack::PopAndDestroy(); // subItem
       
   115         }
       
   116 
       
   117     iMyHost->HandleAdaptationRequestCompleted( iReqId, KErrNone );
       
   118     }
       
   119 
       
   120 // ---------------------------------------------------------------------------
       
   121 // COperationHandlePresentityGroupMemberRemoved::RequestCompleted()
       
   122 // ---------------------------------------------------------------------------
       
   123 //
       
   124 void COperationHandlePresentityGroupMemberRemoved::RequestCompletedL()
       
   125     {
       
   126     TRACE(_L("COperationHandlePresentityGroupMemberRemoved::RequestCompletedL()" ) );
       
   127     CXIMPOperationBase::RequestCompletedL();
       
   128 
       
   129     // no special handling for error situations
       
   130     }
       
   131 
       
   132 
       
   133 // ---------------------------------------------------------------------------
       
   134 // COperationHandlePresentityGroupMemberRemoved::Type()
       
   135 // ---------------------------------------------------------------------------
       
   136 //
       
   137 TInt
       
   138     COperationHandlePresentityGroupMemberRemoved::Type() const
       
   139     {
       
   140     return NPresenceOps::EPrHandlePresentityGroupMemberRemoved;
       
   141     }
       
   142 
       
   143 // End of file