ximpfw/presence/srcpresenceoperations/presentitygroups/operationcreatepresentitygroup.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:  Concrete bind operation
       
    15  *
       
    16 */
       
    17 
       
    18 #include <ximpprotocolconnection.h>
       
    19 #include <protocolpresentitygroups.h>
       
    20 #include <protocolpresencefeatures.h>
       
    21 
       
    22 #include "operationcreatepresentitygroup.h"
       
    23 #include "presentitygroupinfoimp.h"
       
    24 #include "ximpobjecthelpers.h"
       
    25 #include "ximprestrictedobjectcollectionimp.h"
       
    26 #include "protocolpresentitygroupsdatahostimp.h"
       
    27 #include "ximphost.h"
       
    28 #include "ximpstatusimp.h"
       
    29 #include "ximprequestcompleteeventimp.h"
       
    30 #include "protocolpresencedatahostimp.h"
       
    31 
       
    32 #include "ximptrace.h"
       
    33 // ======== MEMBER FUNCTIONS ========
       
    34 
       
    35 // ---------------------------------------------------------------------------
       
    36 // COperationCreatePresentityGroup::COperationCreatePresentityGroup()
       
    37 // ---------------------------------------------------------------------------
       
    38 //
       
    39 EXPORT_C COperationCreatePresentityGroup::COperationCreatePresentityGroup()
       
    40     {
       
    41     }
       
    42 
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 // COperationCreatePresentityGroup::ConstructL
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 void COperationCreatePresentityGroup::ConstructL( const TDesC8& aParamPck )
       
    49     {
       
    50     CPresentityGroupInfoImp* groupInfo = CPresentityGroupInfoImp::NewLC();
       
    51     TXIMPObjectPacker< CPresentityGroupInfoImp >::UnPackL( *groupInfo,
       
    52             aParamPck );
       
    53     CleanupStack::Pop( groupInfo );
       
    54     iGroupInfo = groupInfo;
       
    55     }
       
    56 
       
    57 // ---------------------------------------------------------------------------
       
    58 // COperationCreatePresentityGroup::~COperationCreatePresentityGroup()
       
    59 // ---------------------------------------------------------------------------
       
    60 //
       
    61 COperationCreatePresentityGroup::~COperationCreatePresentityGroup()
       
    62     {
       
    63     delete iGroupInfo;
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 // COperationCreatePresentityGroup::ProcessL()
       
    68 // ---------------------------------------------------------------------------
       
    69 //
       
    70 void COperationCreatePresentityGroup::ProcessL()
       
    71     {
       
    72     TRACE(_L("COperationCreatePresentityGroup::ProcessL()" ) );
       
    73     CXIMPOperationBase::ProcessL();
       
    74     MProtocolPresentityGroups& presentityGroups = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups();
       
    75 
       
    76     presentityGroups.DoCreatePresentityGroupL( iGroupInfo->GroupId(),
       
    77                                                iGroupInfo->GroupDisplayName(), iReqId );
       
    78     }
       
    79 
       
    80 // ---------------------------------------------------------------------------
       
    81 // COperationCreatePresentityGroup::RequestCompleted()
       
    82 // ---------------------------------------------------------------------------
       
    83 //
       
    84 void COperationCreatePresentityGroup::RequestCompletedL()
       
    85     {
       
    86     TRACE(_L("COperationCreatePresentityGroup::RequestCompletedL()" ) );
       
    87     CXIMPOperationBase::RequestCompletedL();
       
    88 
       
    89     MXIMPBase* object = NULL;
       
    90     iObjCollection->GetByType( object, MPresentityGroupInfo::KInterfaceId );
       
    91     if( object )
       
    92         {
       
    93         CPresentityGroupInfoImp* groupInfo = 
       
    94         TXIMPGetImpClassOrPanic< CPresentityGroupInfoImp >::From( *object );
       
    95         
       
    96         delete iGroupInfo;
       
    97         iGroupInfo = groupInfo;
       
    98         }
       
    99 
       
   100     if ( iStatusObj->ResultCode() == KErrNone )
       
   101         {
       
   102         CPresentityGroupInfoImp* groupInfo = 
       
   103                 TXIMPObjectCloner< CPresentityGroupInfoImp >::CloneL( *iGroupInfo );
       
   104         CleanupStack::PushL( groupInfo );
       
   105         iMyHost->PresenceDataAccess().GroupsDataAccess().HandlePresentityGroupCreatedL( groupInfo );
       
   106         CleanupStack::Pop( groupInfo );
       
   107         }
       
   108 
       
   109     // Set information for request complete event.
       
   110     iReqCompleteEvent->AppendParamL( ( CXIMPApiDataObjBase* ) iGroupInfo );
       
   111     iGroupInfo = NULL;
       
   112     }
       
   113 
       
   114 // ---------------------------------------------------------------------------
       
   115 // COperationCreatePresentityGroup::Type()
       
   116 // ---------------------------------------------------------------------------
       
   117 //
       
   118 TInt COperationCreatePresentityGroup::Type() const
       
   119     {
       
   120     return NPresenceOps::EPrCreatePresentityGroup;
       
   121     }
       
   122 
       
   123 
       
   124 // End of file