ximpfw/presence/srcpresenceoperations/presenceauthorization/operationblockpresenceforpresentity.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:  Block presence for presentity operation
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #include <ximpprotocolconnection.h>
       
    20 #include <protocolpresenceauthorization.h>
       
    21 #include <protocolpresencefeatures.h>
       
    22 
       
    23 #include "operationblockpresenceforpresentity.h"
       
    24 #include "presenceblockinfoimp.h"
       
    25 #include "ximpidentityimp.h"
       
    26 #include "protocolpresenceauthorizationdatahostimp.h"
       
    27 #include "ximpobjecthelpers.h"
       
    28 #include "ximprestrictedobjectcollectionimp.h"
       
    29 #include "ximphost.h"
       
    30 #include "ximpstatusimp.h"
       
    31 #include "protocolpresencedatahostimp.h"
       
    32 
       
    33 #include "ximptrace.h"
       
    34 
       
    35 // ============================ MEMBER FUNCTIONS =============================
       
    36 
       
    37 // ---------------------------------------------------------------------------
       
    38 // COperationBlockPresenceForPresentity::COperationBlockPresenceForPresentity()
       
    39 // ---------------------------------------------------------------------------
       
    40 //
       
    41 EXPORT_C COperationBlockPresenceForPresentity::COperationBlockPresenceForPresentity()
       
    42     {
       
    43     }
       
    44 
       
    45 
       
    46 // ---------------------------------------------------------------------------
       
    47 // COperationBlockPresenceForPresentity::~COperationBlockPresenceForPresentity()
       
    48 // ---------------------------------------------------------------------------
       
    49 //
       
    50 COperationBlockPresenceForPresentity::~COperationBlockPresenceForPresentity()
       
    51     {
       
    52     delete iIdentity;
       
    53     delete iBlockInfo;
       
    54     }
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // COperationBlockPresenceForPresentity::ConstructL()
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 void COperationBlockPresenceForPresentity::ConstructL( const TDesC8& aParamPck )
       
    61     {
       
    62     // Read params. identity
       
    63     RDesReadStream rs;
       
    64     rs.Open( aParamPck ); // CSI: 65 # Does not return a value.
       
    65     CleanupClosePushL( rs );
       
    66 
       
    67     // identity
       
    68     iIdentity = CXIMPIdentityImp::NewLC();
       
    69     CleanupStack::Pop( iIdentity );
       
    70     iIdentity->InternalizeL( rs );
       
    71 
       
    72     CleanupStack::PopAndDestroy(); // rs
       
    73     }
       
    74 
       
    75 
       
    76 // ---------------------------------------------------------------------------
       
    77 // COperationBlockPresenceForPresentity::ProcessL()
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 void COperationBlockPresenceForPresentity::ProcessL()
       
    81     {
       
    82     TRACE(_L("COperationBlockPresenceForPresentity::ProcessL()" ) );
       
    83     CXIMPOperationBase::ProcessL();
       
    84 
       
    85     MProtocolPresenceAuthorization& authorization =
       
    86                             iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization();
       
    87 
       
    88     authorization.DoBlockPresenceForPresentityL( *iIdentity, iReqId );
       
    89 
       
    90     }
       
    91 
       
    92 // ---------------------------------------------------------------------------
       
    93 // COperationBlockPresenceForPresentity::RequestCompleted()
       
    94 // ---------------------------------------------------------------------------
       
    95 //
       
    96 void COperationBlockPresenceForPresentity::RequestCompletedL()
       
    97     {
       
    98     TRACE(_L("COperationBlockPresenceForPresentity::RequestCompletedL()" ) );
       
    99     CXIMPOperationBase::RequestCompletedL();
       
   100 
       
   101     MXIMPBase* object = NULL;
       
   102     iObjCollection->GetByType( object,
       
   103                        MPresenceBlockInfo::KInterfaceId );
       
   104     if( object )
       
   105         {
       
   106         CPresenceBlockInfoImp* blockInfo = 
       
   107             TXIMPGetImpClassOrPanic< CPresenceBlockInfoImp >::From( *object );
       
   108         
       
   109         delete iBlockInfo;
       
   110         iBlockInfo = blockInfo;
       
   111         }
       
   112     else // If adaptation didn't return info, wrap the id inside block info
       
   113         {
       
   114         delete iBlockInfo;
       
   115         iBlockInfo = NULL;
       
   116         iBlockInfo = CPresenceBlockInfoImp::NewLC( *iIdentity, KNullDesC );
       
   117         CleanupStack::Pop(); // iBlockinfo
       
   118         }        
       
   119 
       
   120     if ( iStatusObj->ResultCode() == KErrNone )
       
   121         {
       
   122         iMyHost->PresenceDataAccess().AuthorizationDataAccess().HandlePresenceBlockedL( iBlockInfo );
       
   123         iBlockInfo = NULL;
       
   124         }
       
   125 
       
   126     SynthesiseEventL();
       
   127     }
       
   128 
       
   129 
       
   130 // ---------------------------------------------------------------------------
       
   131 // COperationBlockPresenceForPresentity::Type()
       
   132 // ---------------------------------------------------------------------------
       
   133 //
       
   134 TInt
       
   135     COperationBlockPresenceForPresentity::Type() const
       
   136     {
       
   137     return NPresenceOps::EPrBlockPresenceForPresentity;
       
   138     }
       
   139 
       
   140 // ---------------------------------------------------------------------------
       
   141 // COperationBlockPresenceForPresentity::SynthesiseEventL()
       
   142 // ---------------------------------------------------------------------------
       
   143 //
       
   144 void COperationBlockPresenceForPresentity::SynthesiseEventL()
       
   145     {
       
   146     }
       
   147 
       
   148 
       
   149 
       
   150 // End of file