ximpfw/presence/srcpresencefrontend/srcpresencemanager/presencepublishingimp.cpp
changeset 0 e6b17d312c8b
equal deleted inserted replaced
-1:000000000000 0:e6b17d312c8b
       
     1 /*
       
     2 * Copyright (c) 2006,2007 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:  Implementation of MPresenceManagement
       
    15  *
       
    16 */
       
    17 
       
    18 #include "presencepublishingimp.h"
       
    19 #include "presenceinfoimp.h"
       
    20 #include "presenceinfofilterimp.h"
       
    21 #include "ximpobjecthelpers.h"
       
    22 #include "presenceoperationdefs.h"
       
    23 #include "ximpcontextinternal.h"
       
    24 
       
    25 
       
    26 // ============================ MEMBER FUNCTIONS =============================
       
    27 
       
    28 // ---------------------------------------------------------------------------
       
    29 // CPresencePublishingImp::NewL()
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 CPresencePublishingImp* CPresencePublishingImp::NewL( 
       
    33     MXIMPContextInternal& aContext)
       
    34     {
       
    35     CPresencePublishingImp* self = 
       
    36         new( ELeave ) CPresencePublishingImp( aContext);
       
    37 
       
    38     return self;
       
    39     }
       
    40 
       
    41 // ---------------------------------------------------------------------------
       
    42 // Implement supported interface access.
       
    43 // ---------------------------------------------------------------------------
       
    44 //
       
    45 XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresencePublishingImp, 
       
    46                                      MPresencePublishing )
       
    47 XIMPIMP_IF_BASE_GET_INTERFACE_END()
       
    48 
       
    49 
       
    50 XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresencePublishingImp, 
       
    51                                            MPresencePublishing )
       
    52 XIMPIMP_IF_BASE_GET_INTERFACE_END()
       
    53 
       
    54 // ---------------------------------------------------------------------------
       
    55 // CPresencePublishingImp::~CPresencePublishingImp()
       
    56 // ---------------------------------------------------------------------------
       
    57 //
       
    58 CPresencePublishingImp::~CPresencePublishingImp()
       
    59     {
       
    60     //iContext not own
       
    61     }
       
    62 
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // CPresencePublishingImp::CPresencePublishingImp()
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 CPresencePublishingImp::CPresencePublishingImp(
       
    69     MXIMPContextInternal& aContext)
       
    70     : iContext( aContext)
       
    71     {
       
    72     }
       
    73     
       
    74 // ---------------------------------------------------------------------------
       
    75 // From class MPresencePublishing.
       
    76 // CPresencePublishingImp::SubscribeOwnPresenceL()
       
    77 // ---------------------------------------------------------------------------
       
    78 //
       
    79 TXIMPRequestId CPresencePublishingImp::SubscribeOwnPresenceL( 
       
    80                                             const MPresenceInfoFilter& aPif )
       
    81     {
       
    82     HBufC8* pifPack = PackPresenceInfoFilterLC( aPif );
       
    83 
       
    84     TXIMPRequestId reqId =
       
    85         iContext.QueueOperationL( NPresenceOps::EPrSubscribeOwnPresence,
       
    86                                    *pifPack );
       
    87     CleanupStack::PopAndDestroy( pifPack );
       
    88 
       
    89     return reqId;    
       
    90     }
       
    91 
       
    92 // ---------------------------------------------------------------------------
       
    93 // From class MPresencePublishing.
       
    94 // CPresencePublishingImp::UnsubscribeOwnPresenceL()
       
    95 // ---------------------------------------------------------------------------
       
    96 //
       
    97 TXIMPRequestId CPresencePublishingImp::UnsubscribeOwnPresenceL()
       
    98     {
       
    99     return iContext.QueueOperationL( NPresenceOps::EPrUnsubscribeOwnPresence, 
       
   100                                       KNullDesC8 );
       
   101     }
       
   102 
       
   103 // ---------------------------------------------------------------------------
       
   104 // From class MPresencePublishing.
       
   105 // CPresencePublishingImp::PublishOwnPresenceL()
       
   106 // ---------------------------------------------------------------------------
       
   107 //
       
   108 TXIMPRequestId CPresencePublishingImp::PublishOwnPresenceL(
       
   109     const MPresenceInfo& aPresence )
       
   110     {
       
   111     HBufC8* docPack = PackPresenceDocLC( aPresence );
       
   112 
       
   113     TXIMPRequestId reqId =
       
   114         iContext.QueueOperationL( NPresenceOps::EPrPublishOwnPresence,
       
   115                                    *docPack );
       
   116     CleanupStack::PopAndDestroy( docPack );
       
   117 
       
   118     return reqId;
       
   119     }
       
   120 
       
   121 
       
   122 
       
   123 // ---------------------------------------------------------------------------
       
   124 // From class MPresencePublishing.
       
   125 // CPresencePublishingImp::SubscribePresenceWatcherListL()
       
   126 // ---------------------------------------------------------------------------
       
   127 //
       
   128 TXIMPRequestId CPresencePublishingImp::SubscribePresenceWatcherListL()
       
   129     {
       
   130     return iContext.QueueOperationL(
       
   131                            NPresenceOps::EPrSubscribePresenceWatcherList,
       
   132                            KNullDesC8 );    
       
   133     }
       
   134 
       
   135 // ---------------------------------------------------------------------------
       
   136 // From class MPresencePublishing.
       
   137 // CPresencePublishingImp::UnsubscribePresenceWatcherListL()
       
   138 // ---------------------------------------------------------------------------
       
   139 //
       
   140 TXIMPRequestId CPresencePublishingImp::UnsubscribePresenceWatcherListL()
       
   141     {
       
   142     return iContext.QueueOperationL(
       
   143                            NPresenceOps::EPrUnsubscribePresenceWatcherList,
       
   144                            KNullDesC8 );    
       
   145     }
       
   146 
       
   147 
       
   148 // ---------------------------------------------------------------------------
       
   149 // CPresencePublishingImp::PackPresenceDocLC()
       
   150 // ---------------------------------------------------------------------------
       
   151 //
       
   152 HBufC8* CPresencePublishingImp::PackPresenceDocLC(
       
   153     const MPresenceInfo& aPresence )
       
   154     {
       
   155     const CPresenceInfoImp* docImp = 
       
   156     TXIMPGetImpClassOrPanic< const CPresenceInfoImp >::From( aPresence );
       
   157     
       
   158     HBufC8* pack = TXIMPObjectPacker< const CPresenceInfoImp >::PackL( *docImp );
       
   159     CleanupStack::PushL( pack );
       
   160 
       
   161     return pack;
       
   162     }
       
   163 
       
   164 // ---------------------------------------------------------------------------
       
   165 // CPresencePublishingImp::PackPresenceDocLC()
       
   166 // ---------------------------------------------------------------------------
       
   167 //
       
   168 HBufC8* CPresencePublishingImp::PackPresenceInfoFilterLC(
       
   169     const MPresenceInfoFilter& aPif )
       
   170     {
       
   171     const CPresenceInfoFilterImp* pifImp = 
       
   172     TXIMPGetImpClassOrPanic< const CPresenceInfoFilterImp >::From( aPif );    
       
   173     
       
   174     HBufC8* pack = TXIMPObjectPacker< CPresenceInfoFilterImp>::PackL( *pifImp );
       
   175     CleanupStack::PushL( pack );
       
   176 
       
   177     return pack;
       
   178     }