ximpfw/presence/srcpresenceoperations/presentitygroups/operationupdatepresentitygroupmemberdisplayname.cpp
changeset 51 61fad867f68e
equal deleted inserted replaced
-1:000000000000 51:61fad867f68e
       
     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:  Update Presentity Group Member Display Name operation
       
    15  *
       
    16 */
       
    17 
       
    18 #include <s32mem.h>
       
    19 #include <protocolpresentitygroups.h>
       
    20 #include <ximpprotocolconnection.h>
       
    21 #include <protocolpresencefeatures.h>
       
    22 
       
    23 #include "operationupdatepresentitygroupmemberdisplayname.h"
       
    24 #include "presentitygroupmemberinfoimp.h"
       
    25 #include "ximpidentityimp.h"
       
    26 #include "protocolpresentitygroupsdatahostimp.h"
       
    27 #include "ximprbufhelpers.h"
       
    28 #include "ximprestrictedobjectcollectionimp.h"
       
    29 #include "ximphost.h"
       
    30 #include "ximpstatusimp.h"
       
    31 #include "ximprequestcompleteeventimp.h"
       
    32 #include "ximpobjecthelpers.h"
       
    33 #include "protocolpresencedatahostimp.h"
       
    34 
       
    35 #include "ximptrace.h"
       
    36 // ======== MEMBER FUNCTIONS ========
       
    37 
       
    38 // ---------------------------------------------------------------------------
       
    39 // COperationUpdatePresentityGroupMemberDisplayName::COperationUpdatePresentityGroupMemberDisplayName()
       
    40 // ---------------------------------------------------------------------------
       
    41 //
       
    42 EXPORT_C COperationUpdatePresentityGroupMemberDisplayName::COperationUpdatePresentityGroupMemberDisplayName()
       
    43     {
       
    44     }
       
    45 
       
    46 
       
    47 // ---------------------------------------------------------------------------
       
    48 // COperationUpdatePresentityGroupMemberDisplayName::ConstructL
       
    49 // ---------------------------------------------------------------------------
       
    50 //
       
    51 void COperationUpdatePresentityGroupMemberDisplayName::ConstructL( const TDesC8& aParamPck )
       
    52     {
       
    53     RDesReadStream rs;
       
    54     rs.Open( aParamPck ); // CSI: 65 # Does not return a value.
       
    55     CleanupClosePushL( rs );
       
    56 
       
    57     // group id
       
    58     iGroupId = CXIMPIdentityImp::NewLC();
       
    59     CleanupStack::Pop( iGroupId );
       
    60     iGroupId->InternalizeL( rs );
       
    61 
       
    62     // member id
       
    63     CXIMPIdentityImp* memberId = CXIMPIdentityImp::NewLC();
       
    64     memberId->InternalizeL( rs );
       
    65 
       
    66     // member display name
       
    67     RBuf16 dispName;
       
    68     CleanupClosePushL( dispName );
       
    69     XIMPRBuf16Helper::InternalizeL( dispName, rs );
       
    70 
       
    71     iMemberInfo = CPresentityGroupMemberInfoImp::NewLC( *memberId, dispName );
       
    72     CleanupStack::Pop( iMemberInfo );
       
    73     CleanupStack::PopAndDestroy( 3 ); // dispName, memberId, rs
       
    74     }
       
    75 
       
    76 // ---------------------------------------------------------------------------
       
    77 // COperationUpdatePresentityGroupMemberDisplayName::~COperationUpdatePresentityGroupMemberDisplayName()
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 COperationUpdatePresentityGroupMemberDisplayName::~COperationUpdatePresentityGroupMemberDisplayName()
       
    81     {
       
    82     delete iGroupId;
       
    83     delete iMemberInfo;
       
    84     }
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // COperationUpdatePresentityGroupMemberDisplayName::ProcessL()
       
    88 // ---------------------------------------------------------------------------
       
    89 //
       
    90 void COperationUpdatePresentityGroupMemberDisplayName::ProcessL()
       
    91     {
       
    92     TRACE(_L("COperationUpdatePresentityGroupMemberDisplayName::ProcessL()" ) );
       
    93     CXIMPOperationBase::ProcessL();
       
    94 
       
    95     MProtocolPresentityGroups& presentityGroups = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups();
       
    96 
       
    97     presentityGroups.DoUpdatePresentityGroupMemberDisplayNameL(
       
    98                                                 *iGroupId,
       
    99                                                 iMemberInfo->GroupMemberId(),
       
   100                                                 iMemberInfo->GroupMemberDisplayName(),
       
   101                                                 iReqId );
       
   102     }
       
   103 
       
   104 // ---------------------------------------------------------------------------
       
   105 // COperationUpdatePresentityGroupMemberDisplayName::RequestCompleted()
       
   106 // ---------------------------------------------------------------------------
       
   107 //
       
   108 void COperationUpdatePresentityGroupMemberDisplayName::RequestCompletedL()
       
   109     {
       
   110     TRACE(_L("COperationUpdatePresentityGroupMemberDisplayName::RequestCompletedL()" ) );
       
   111     CXIMPOperationBase::RequestCompletedL();
       
   112 
       
   113     MXIMPBase* object = NULL;
       
   114     iObjCollection->GetByType( object, MPresentityGroupMemberInfo::KInterfaceId );
       
   115     if( object )
       
   116         {
       
   117         CPresentityGroupMemberInfoImp* memberInfo = 
       
   118             TXIMPGetImpClassOrPanic< CPresentityGroupMemberInfoImp >::From( *object );
       
   119         delete iMemberInfo;
       
   120         iMemberInfo = memberInfo;
       
   121         }
       
   122 
       
   123     if ( iStatusObj->ResultCode() == KErrNone )
       
   124         {
       
   125         CXIMPIdentityImp* groupId = 
       
   126                 TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( *iGroupId );
       
   127         CleanupStack::PushL( groupId );
       
   128         CPresentityGroupMemberInfoImp* memberInfo = 
       
   129                 TXIMPObjectCloner< CPresentityGroupMemberInfoImp >::CloneL( *iMemberInfo );
       
   130         CleanupStack::PushL( memberInfo );        
       
   131         iMyHost->PresenceDataAccess().GroupsDataAccess().HandlePresentityGroupMemberDisplayNameUpdatedL( groupId, memberInfo );
       
   132         CleanupStack::Pop( 2, groupId );
       
   133         }
       
   134 
       
   135     // Set information for request complete event.
       
   136     iReqCompleteEvent->AppendParamL( iGroupId );
       
   137     iGroupId = NULL;
       
   138     iReqCompleteEvent->AppendParamL( iMemberInfo );
       
   139     iMemberInfo = NULL;
       
   140     }
       
   141 
       
   142 // ---------------------------------------------------------------------------
       
   143 // COperationUpdatePresentityGroupMemberDisplayName::Type()
       
   144 // ---------------------------------------------------------------------------
       
   145 //
       
   146 TInt COperationUpdatePresentityGroupMemberDisplayName::Type() const
       
   147     {
       
   148     return NPresenceOps::EPrUpdatePresentityGroupMemberDisplayName;
       
   149     }
       
   150 
       
   151 // End of file