ximpfw/presence/srcpresenceoperations/presentitygroups/operationhandlepresentitygroupmemberdisplaynameupdated.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 "operationhandlepresentitygroupmemberdisplaynameupdated.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 // ============================ MEMBER FUNCTIONS =============================
       
    32 
       
    33 // ---------------------------------------------------------------------------
       
    34 // COperationHandlePresentityGroupMemberDisplayNameUpdated::~COperationHandlePresentityGroupMemberDisplayNameUpdated()
       
    35 // ---------------------------------------------------------------------------
       
    36 //
       
    37 COperationHandlePresentityGroupMemberDisplayNameUpdated::~COperationHandlePresentityGroupMemberDisplayNameUpdated()
       
    38     {
       
    39     delete iMemberInfo;
       
    40     delete iGroupId;
       
    41     }
       
    42 
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 // COperationHandlePresentityGroupMemberDisplayNameUpdated::COperationHandlePresentityGroupMemberDisplayNameUpdated()
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 EXPORT_C COperationHandlePresentityGroupMemberDisplayNameUpdated::COperationHandlePresentityGroupMemberDisplayNameUpdated()
       
    49     {
       
    50     }
       
    51 
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // COperationHandlePresentityGroupMemberDisplayNameUpdated::ConstructL()
       
    55 // ---------------------------------------------------------------------------
       
    56 //
       
    57 void COperationHandlePresentityGroupMemberDisplayNameUpdated::ConstructL( const TDesC8& /*aParamPck*/ )
       
    58     {
       
    59     }
       
    60 
       
    61 
       
    62 // ---------------------------------------------------------------------------
       
    63 // COperationHandlePresentityGroupMemberDisplayNameUpdated::ProcessL()
       
    64 // ---------------------------------------------------------------------------
       
    65 //
       
    66 void COperationHandlePresentityGroupMemberDisplayNameUpdated::ProcessL()
       
    67     {
       
    68     TRACE(_L("COperationHandlePresentityGroupMemberDisplayNameUpdated::ProcessL()") );
       
    69     CXIMPOperationBase::ProcessL();
       
    70 
       
    71     MXIMPBase* object = NULL;
       
    72     iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId );
       
    73     if( object )
       
    74         {
       
    75         iGroupId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object );        
       
    76         }
       
    77     else
       
    78         {
       
    79         User::Leave( KErrArgument );
       
    80         }
       
    81         
       
    82     object = NULL;
       
    83     iObjCollection->GetByType( object, MPresentityGroupMemberInfo::KInterfaceId );
       
    84     if( object )
       
    85         {
       
    86         iMemberInfo = TXIMPGetImpClassOrPanic< CPresentityGroupMemberInfoImp >::From( *object );
       
    87         }
       
    88     else
       
    89         {
       
    90         User::Leave( KErrArgument );
       
    91         }
       
    92 
       
    93     TInt err = KErrNone;
       
    94 
       
    95     if ( iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemExists( *iGroupId ) )
       
    96         {
       
    97         CGroupContentSubscriptionItem& subItem =
       
    98             iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemLC( *iGroupId );
       
    99 
       
   100         // clean out temporary lists
       
   101         subItem.Clean();
       
   102 
       
   103         if ( subItem.GroupMemberExistsL( *iMemberInfo )  &&
       
   104              subItem.IsGroupMemberUpdatedL( *iMemberInfo ) )
       
   105             {
       
   106             RPrGrpMemInfoImpArray* updated = new ( ELeave ) RPrGrpMemInfoImpArray;
       
   107             CleanupStack::PushL( updated );
       
   108             updated->AppendL( iMemberInfo );
       
   109             iMemberInfo = NULL; // ownership was transferred
       
   110 
       
   111             subItem.SetAddedListL( updated );
       
   112             CleanupStack::Pop( updated ); // ownership was transferred
       
   113 
       
   114             // synthesize the event to all contexts
       
   115             TRAP( err, subItem.SynthesiseSubscriptionEventToAllCtxsL() );
       
   116             }
       
   117             
       
   118         CleanupStack::PopAndDestroy(); // subItem
       
   119         }
       
   120 
       
   121     iMyHost->HandleAdaptationRequestCompleted( iReqId, err );  // error code means subsc. synth. error
       
   122     }
       
   123 
       
   124 // ---------------------------------------------------------------------------
       
   125 // COperationHandlePresentityGroupMemberDisplayNameUpdated::RequestCompleted()
       
   126 // ---------------------------------------------------------------------------
       
   127 //
       
   128 void COperationHandlePresentityGroupMemberDisplayNameUpdated::RequestCompletedL()
       
   129     {
       
   130     TRACE(_L("COperationHandlePresentityGroupMemberDisplayNameUpdated::RequestCompletedL()" ) );
       
   131     CXIMPOperationBase::RequestCompletedL();
       
   132 
       
   133     // no special handling for error situations
       
   134     }
       
   135     
       
   136 
       
   137 // ---------------------------------------------------------------------------
       
   138 // COperationHandlePresentityGroupMemberDisplayNameUpdated::Type()
       
   139 // ---------------------------------------------------------------------------
       
   140 //
       
   141 TInt
       
   142     COperationHandlePresentityGroupMemberDisplayNameUpdated::Type() const
       
   143     {
       
   144     return NPresenceOps::EPrHandlePresentityGroupMemberDisplayNameUpdated;
       
   145     }
       
   146 
       
   147 // End of file