ximpfw/presence/srcpresencedatamodel/presenceauthorization/presencetoeveryoneconfigurationitem.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:  Presence to everyone configuration item
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "presencetoeveryoneconfigurationitem.h"
       
    20 #include "ximpitemparent.h"
       
    21 #include "presenceinfofilterimp.h"
       
    22 #include "ximppanics.h"
       
    23 #include "ximppsccontext.h"
       
    24 #include "documentutils.h"
       
    25 #include "presentitypresenceeventimp.h"
       
    26 
       
    27 #include "ximptrace.h"
       
    28 
       
    29 // ---------------------------------------------------------------------------
       
    30 // CPresenceToEveryoneConfigurationItem::CPresenceToEveryoneConfigurationItem()
       
    31 // ---------------------------------------------------------------------------
       
    32 //
       
    33 CPresenceToEveryoneConfigurationItem::CPresenceToEveryoneConfigurationItem( MXIMPItemParentBase& aParent )
       
    34 : CXIMPConfigurationItemBase( aParent )
       
    35     {
       
    36     }
       
    37 
       
    38 
       
    39 // ---------------------------------------------------------------------------
       
    40 // CPresenceToEveryoneConfigurationItem::ConstructL()
       
    41 // ---------------------------------------------------------------------------
       
    42 //
       
    43 void CPresenceToEveryoneConfigurationItem::ConstructL()
       
    44     {
       
    45     CXIMPConfigurationItemBase::BaseConstructL();
       
    46     }
       
    47 
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 // CPresenceToEveryoneConfigurationItem::NewLC()
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 CPresenceToEveryoneConfigurationItem*
       
    54     CPresenceToEveryoneConfigurationItem::NewLC( MXIMPItemParentBase& aParent )
       
    55     {
       
    56     CPresenceToEveryoneConfigurationItem* self =
       
    57         new( ELeave ) CPresenceToEveryoneConfigurationItem( aParent );
       
    58     CleanupClosePushL( *self );
       
    59     self->ConstructL();
       
    60     return self;
       
    61     }
       
    62 
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // CPresenceToEveryoneConfigurationItem::~CPresenceToEveryoneConfigurationItem()
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 CPresenceToEveryoneConfigurationItem::~CPresenceToEveryoneConfigurationItem()
       
    69     {
       
    70     MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
       
    71     presCache->RemoveMe( this );
       
    72 
       
    73     delete iPif;    
       
    74     }
       
    75 
       
    76 // ---------------------------------------------------------------------------
       
    77 // CPresenceToEveryoneConfigurationItem::ConfigurationPif()
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 EXPORT_C CPresenceInfoFilterImp& 
       
    81             CPresenceToEveryoneConfigurationItem::ConfigurationPif()
       
    82     {
       
    83     TRACE(_L("CPresenceToEveryoneConfigurationItem::ConfigurationPif" ) );
       
    84     __ASSERT_ALWAYS( iPif, User::Panic( NXIMPPrivPanic::KCategory, 
       
    85                                         NXIMPPrivPanic::EOwnPresencePifNotSet ) );
       
    86     return *iPif;
       
    87     }
       
    88 
       
    89 // ---------------------------------------------------------------------------
       
    90 // CPresenceToEveryoneConfigurationItem::SetSubscriptionPif()
       
    91 // ---------------------------------------------------------------------------
       
    92 //
       
    93 EXPORT_C void CPresenceToEveryoneConfigurationItem::SetConfigurationPif(
       
    94                                                 CPresenceInfoFilterImp* aPif )
       
    95     {
       
    96     TRACE(_L("CPresenceToEveryoneConfigurationItem::SetConfigurationPif" ) );
       
    97     if ( !aPif )
       
    98         {
       
    99         TRACE(_L("CPresenceToEveryoneConfigurationItem::SetConfigurationPif aPif NULL" ) );
       
   100         }
       
   101     delete iPif;
       
   102     iPif = aPif;
       
   103     }
       
   104     
       
   105 // ---------------------------------------------------------------------------
       
   106 // CPresenceToEveryoneConfigurationItem::CollectSubscriptionPifWithoutCtxL()
       
   107 // ---------------------------------------------------------------------------
       
   108 //
       
   109 EXPORT_C CPresenceInfoFilterImp* 
       
   110     CPresenceToEveryoneConfigurationItem::CollectConfigurationPifWithoutCtxL( 
       
   111                                                         MXIMPPscContext* aContext )
       
   112     {
       
   113     TRACE(_L("CPresenceToEveryoneConfigurationItem::CollectConfigurationPifWithoutCtxL" ) );
       
   114     RPointerArray< CPresenceInfoFilterImp > arrayOfPifs;
       
   115     CleanupClosePushL( arrayOfPifs );
       
   116     
       
   117     TInt count = iConfigContexts.Count();
       
   118     for( TInt a = 0; a < count; ++a )
       
   119         {
       
   120         if( iConfigContexts[ a ] != aContext )
       
   121             {
       
   122             CPresenceInfoFilterImp* filter = iConfigContexts[ a ]->PresenceInfoFilter( 
       
   123                         MXIMPPscContext::EGrantPresenceToEveryoneFilter );
       
   124             if ( filter )
       
   125                 {
       
   126                 arrayOfPifs.AppendL( filter );
       
   127                 }
       
   128             }        
       
   129         }
       
   130     CPresenceInfoFilterImp* pifWithoutCtx = DocumentUtils::InfoFilterUnionL( arrayOfPifs );    
       
   131     CleanupStack::PopAndDestroy(); // arrayOfPifs
       
   132     return pifWithoutCtx;
       
   133     }
       
   134 
       
   135 // ---------------------------------------------------------------------------
       
   136 // From class MXIMPSubscriptionItem.
       
   137 // CPresenceToEveryoneConfigurationItem::SynthesiseSubscriptionEventTo()
       
   138 // ---------------------------------------------------------------------------
       
   139 //
       
   140 void CPresenceToEveryoneConfigurationItem::SynthesiseSubscriptionEventToL(
       
   141                                                     MXIMPPscContext* aContext,
       
   142                                                     TBool aForceEvent )
       
   143     {
       
   144     TRACE_1( _L("CPresenceToEveryoneConfigurationItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent );
       
   145     XIMP_UNUSED_FORMAL_PARAM( aContext );
       
   146     XIMP_UNUSED_FORMAL_PARAM( aForceEvent );
       
   147     }
       
   148 
       
   149 // ---------------------------------------------------------------------------
       
   150 // CPresenceToEveryoneConfigurationItem::CleanExpired()
       
   151 // ---------------------------------------------------------------------------
       
   152 //
       
   153 void CPresenceToEveryoneConfigurationItem::CleanExpired()
       
   154     {
       
   155     
       
   156     }
       
   157 
       
   158 // End of file