ximpfw/presence/srcpresencedatamodel/presentitygroups/groupcontentsubscriptionitem.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 Service Connection group member subscription implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <badesca.h>
       
    20 
       
    21 #include "groupcontentsubscriptionitem.h"
       
    22 #include "presenceinfofilterimp.h"
       
    23 #include "ximpitemparent.h"
       
    24 #include "ximppanics.h"
       
    25 #include "ximppsccontext.h"
       
    26 #include "documentutils.h"
       
    27 #include "presentitygroupcontenteventimp.h"
       
    28 #include "presencetypehelpers.h"
       
    29 #include "ximpobjecthelpers.h"
       
    30 #include "presentitygroupmemberinfoimp.h"
       
    31 #include "ximpidentityimp.h"
       
    32 #include "groupcontenteventobserver.h"
       
    33 
       
    34 #include "ximptrace.h"
       
    35 // ---------------------------------------------------------------------------
       
    36 // CGroupContentSubscriptionItem::CGroupContentSubscriptionItem()
       
    37 // ---------------------------------------------------------------------------
       
    38 //
       
    39 CGroupContentSubscriptionItem::CGroupContentSubscriptionItem( MXIMPItemParentBase& aParent )
       
    40 : CXIMPSubscriptionItemBase( aParent )
       
    41     {
       
    42     }
       
    43 
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // CGroupContentSubscriptionItem::ConstructL()
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 void CGroupContentSubscriptionItem::ConstructL( const CXIMPIdentityImp& aGroupId )
       
    50     {
       
    51     BaseConstructL();
       
    52     
       
    53     iGroupId = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( aGroupId );
       
    54 
       
    55     // empty lists must always exist
       
    56     iCurrentMembers = new ( ELeave) RPrGrpMemInfoImpArray;
       
    57 
       
    58     iAdded = new ( ELeave ) RPrGrpMemInfoImpArray;
       
    59     iUpdated = new ( ELeave ) RPrGrpMemInfoImpArray;
       
    60     iRemoved = new ( ELeave ) RPrGrpMemInfoImpArray;
       
    61     }
       
    62 
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // CGroupContentSubscriptionItem::NewLC()
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 CGroupContentSubscriptionItem*
       
    69         CGroupContentSubscriptionItem::NewLC( MXIMPItemParentBase& aParent,
       
    70                                                      const CXIMPIdentityImp& aGroupId )
       
    71     {
       
    72     CGroupContentSubscriptionItem* self =
       
    73                 new( ELeave ) CGroupContentSubscriptionItem( aParent );
       
    74     CleanupClosePushL( *self );
       
    75     self->ConstructL( aGroupId );
       
    76     return self;
       
    77     }
       
    78 
       
    79 
       
    80 // ---------------------------------------------------------------------------
       
    81 // CGroupContentSubscriptionItem::~CGroupContentSubscriptionItem()
       
    82 // ---------------------------------------------------------------------------
       
    83 //
       
    84 CGroupContentSubscriptionItem::~CGroupContentSubscriptionItem()
       
    85     {
       
    86         MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
       
    87     presCache->RemoveMe( this );
       
    88 
       
    89 
       
    90     if ( iCurrentMembers )
       
    91         {
       
    92         iCurrentMembers->Close();
       
    93         }
       
    94     delete iCurrentMembers;
       
    95 
       
    96     Clean();
       
    97     delete iAdded;
       
    98     delete iUpdated;
       
    99     delete iRemoved;
       
   100 
       
   101     delete iGroupId;
       
   102 
       
   103     iEventObservers.Close();
       
   104     }
       
   105 
       
   106 
       
   107 // ---------------------------------------------------------------------------
       
   108 // CGroupContentSubscriptionItem::AddOrRenewSubscriberL()
       
   109 // ---------------------------------------------------------------------------
       
   110 //
       
   111 EXPORT_C void CGroupContentSubscriptionItem::AddOrRenewSubscriberL(
       
   112         MXIMPPscContext* aContext )
       
   113     {
       
   114     TInt index = iContexts.Find( aContext );
       
   115     if( index == KErrNotFound )
       
   116         {
       
   117         iContexts.AppendL( aContext );
       
   118         User::LeaveIfError( Open() );
       
   119         }
       
   120     }
       
   121 
       
   122 // ---------------------------------------------------------------------------
       
   123 // CGroupContentSubscriptionItem::GroupId()
       
   124 // ---------------------------------------------------------------------------
       
   125 //
       
   126 EXPORT_C const CXIMPIdentityImp& CGroupContentSubscriptionItem::GroupId() const
       
   127     {
       
   128     return *iGroupId;
       
   129     }
       
   130 
       
   131 // ---------------------------------------------------------------------------
       
   132 // CGroupContentSubscriptionItem::Order()
       
   133 // ---------------------------------------------------------------------------
       
   134 //
       
   135 EXPORT_C TInt CGroupContentSubscriptionItem::Order(
       
   136                         const CGroupContentSubscriptionItem& aA,
       
   137                         const CGroupContentSubscriptionItem& aB )
       
   138     {
       
   139     return IdentityOrder( aA.iGroupId, aB );
       
   140     }
       
   141 // ---------------------------------------------------------------------------
       
   142 // CPresentityPresenceSubscriptionItem::Order()
       
   143 // ---------------------------------------------------------------------------
       
   144 //
       
   145 EXPORT_C TInt CGroupContentSubscriptionItem::IdentityOrder(
       
   146                         const CXIMPIdentityImp* aA,
       
   147                         const CGroupContentSubscriptionItem& aB )
       
   148     {
       
   149     return aA->Compare( *aB.iGroupId );
       
   150     }
       
   151 
       
   152 // ---------------------------------------------------------------------------
       
   153 // From MXIMPSubscriptionItem class.
       
   154 // CGroupContentSubscriptionItem::SynthesiseSubscriptionEventTo()
       
   155 // ---------------------------------------------------------------------------
       
   156 //
       
   157 void CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToL(
       
   158         MXIMPPscContext* aContext, TBool aForceEvent )
       
   159     {
       
   160     TRACE_1( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventTo() aForce=%d"), aForceEvent );
       
   161     CXIMPDataSubscriptionStateImp* status = StatusLC( aContext );
       
   162 
       
   163     if( status->DataState() == MXIMPDataSubscriptionState::EDataAvailable || aForceEvent )
       
   164         {
       
   165         CPresentityGroupContentEventImp* newEvent =
       
   166             CPresentityGroupContentEventImp::NewL( *iGroupId,
       
   167                     iAdded,
       
   168                     iUpdated,
       
   169                     iRemoved,
       
   170                     aForceEvent ? iCurrentMembers : NULL,
       
   171                     status
       
   172                     );
       
   173         CleanupStack::Pop(); //status
       
   174         CleanupStack::PushL( newEvent );
       
   175         MXIMPItemParent* presCache = static_cast<MXIMPItemParent*>(iParent.GetInterface(PRESENCE_ITEM_PARENT));
       
   176         presCache->AddEventL( *newEvent, aContext );
       
   177         }        
       
   178     CleanupStack::PopAndDestroy(); // status || newEvent. Depending on branch.
       
   179     }
       
   180 
       
   181 // ---------------------------------------------------------------------------
       
   182 // CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL()
       
   183 // ---------------------------------------------------------------------------
       
   184 //
       
   185 void CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL()
       
   186 {
       
   187 
       
   188 TRACE_1( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL() iEventObservers.Count()=%d"), iEventObservers.Count() );
       
   189 TRACE_1( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL() iAdded->Count()=%d"), iAdded->Count() );
       
   190 TRACE_1( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL() iUpdated->Count()=%d"), iUpdated->Count() );
       
   191 TRACE_1( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL() iRemoved->Count()=%d"), iRemoved->Count() );
       
   192 
       
   193     TInt count = iEventObservers.Count();
       
   194     if( count && iAdded->Count() )
       
   195     {
       
   196         for( TInt a = 0; a < count; ++a )
       
   197         {
       
   198         TRACE_1( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL() observer = iEventObservers[ a ] =%d"), a );
       
   199             MGroupContentEventObserver* observer = iEventObservers[ a ];
       
   200         TInt error ( KErrNone );
       
   201         TRAP( error, observer->HandleSynthesiseL( *iAdded ););
       
   202         TRACE_1( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL()  TRAPD( error, observer->HandleSynthesiseL =%d"), error );
       
   203         }
       
   204     }
       
   205 
       
   206   TRACE( _L("CGroupContentSubscriptionItem::SynthesiseSubscriptionEventToAllCtxsL - Call to CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL Now ") );
       
   207     CXIMPSubscriptionItemBase::SynthesiseSubscriptionEventToAllCtxsL();
       
   208 }
       
   209 
       
   210 // ---------------------------------------------------------------------------
       
   211 // CGroupContentSubscriptionItem::SetNewListL()
       
   212 // ---------------------------------------------------------------------------
       
   213 //
       
   214 EXPORT_C void CGroupContentSubscriptionItem::SetNewListL(
       
   215         RPrGrpMemInfoImpArray* aMemberList )
       
   216     {
       
   217     TRACE_1( _L("CGroupContentSubscriptionItem::SetNewListL() aMemberList Count=%d"), aMemberList->Count() );
       
   218     // we will eventually take ownership to this
       
   219     RPrGrpMemInfoImpArray* tmp = aMemberList;
       
   220     CleanupStack::PushL( tmp );
       
   221 
       
   222     // the list is already sorted. when a copy was made in datacacheimp, the
       
   223     // InsertInOrder method was used
       
   224 
       
   225     // The below algorithm has complexity of (roughly):
       
   226     //   - aMemberList length M
       
   227     //   - iCurrentMembers final length N
       
   228     //
       
   229     //   Final complexity:
       
   230     //     M*(    1     // indexed accessor
       
   231     //          + logN  // find (ordered)
       
   232     //          + logN  // insert in order (find+insert)
       
   233     //          + O(1)  // delete
       
   234     //          + O(1)  // remove
       
   235     //        ) + O(1)  // updating iRemoved and iCurrentMembers
       
   236     //     = M(2logN+3) + 2MlogN+3M = O(cMlogM).
       
   237     //
       
   238     // Should be fast enough. The complexity is not fully accurate because
       
   239     // array size grows as we insert into it.
       
   240     //
       
   241     TLinearOrder<CPresentityGroupMemberInfoImp>
       
   242         linearOrder( CPresentityGroupMemberInfoImp::GroupIdLinearOrder );
       
   243 
       
   244     for ( TInt i = 0; i < tmp->Count(); i++ )
       
   245         {
       
   246         // compare against current list
       
   247         CPresentityGroupMemberInfoImp* info = (*tmp)[ i ];
       
   248         TInt pos = iCurrentMembers->FindInOrder( info, linearOrder );
       
   249 
       
   250         if ( pos == KErrNotFound )
       
   251             {
       
   252             // not found in current list
       
   253             // so must be a fresh created list name
       
   254             iAdded->InsertInOrderL( info, linearOrder );
       
   255             }
       
   256         else
       
   257             {
       
   258             // found in current list, so it must be an updated list name
       
   259             iUpdated->InsertInOrderL( info, linearOrder );
       
   260 
       
   261             delete (*iCurrentMembers)[ pos ];
       
   262             iCurrentMembers->Remove( pos );
       
   263 
       
   264             // we must remove the found ones from iCurrentMembers,
       
   265             // otherwise we will not know what was left. and finding out
       
   266             // the removed items will be difficult.
       
   267             }
       
   268         }
       
   269 
       
   270     // what's left in iCurrentMembers contains the deleted ones.
       
   271     delete iRemoved;
       
   272     iRemoved = iCurrentMembers;
       
   273 
       
   274     // the given list becomes the new list
       
   275     iCurrentMembers = tmp;
       
   276     CleanupStack::Pop( tmp );
       
   277     iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
       
   278     InformObserversL();
       
   279     }
       
   280 
       
   281 
       
   282 // ---------------------------------------------------------------------------
       
   283 // CGroupContentSubscriptionItem::SetAddedListL()
       
   284 // ---------------------------------------------------------------------------
       
   285 //
       
   286 EXPORT_C void CGroupContentSubscriptionItem::SetAddedListL(
       
   287         RPrGrpMemInfoImpArray* aMemberList )
       
   288     {
       
   289     TRACE_1( _L("CGroupContentSubscriptionItem::SetAddedListL() aMemberList Count=%d"), aMemberList->Count() );
       
   290     // we took ownership to the given list
       
   291     RPrGrpMemInfoImpArray* tmp = aMemberList;
       
   292     CleanupDeletePushL( tmp );
       
   293 
       
   294     // see also SetNewListL.
       
   295 
       
   296     // the list is already sorted. when a copy was made in datacacheimp, the
       
   297     // InsertInOrder method was used
       
   298     TLinearOrder<CPresentityGroupMemberInfoImp>
       
   299         linearOrder( CPresentityGroupMemberInfoImp::GroupIdLinearOrder );
       
   300 
       
   301     // update the list of created and updated groups
       
   302     for ( TInt i = 0; i < tmp->Count(); i++ )
       
   303         {
       
   304         // compare against current list
       
   305         CPresentityGroupMemberInfoImp* info = (*tmp)[ i ];
       
   306         TInt pos = iCurrentMembers->FindInOrder( info, linearOrder );
       
   307 
       
   308         if ( pos == KErrNotFound )
       
   309             {
       
   310             // not found in current list
       
   311             // so must be a fresh created list name.
       
   312             // this cannot come when the HandleDisplayNameUpdatedListL method
       
   313             // is called.
       
   314             iCurrentMembers->InsertInOrderL( info, linearOrder );
       
   315             ( *tmp )[ i ] = NULL;
       
   316             iAdded->InsertInOrderL( info, linearOrder );
       
   317             }
       
   318         else
       
   319             {
       
   320             // This can be checked if really had changed if needed. Now
       
   321             // we trust server that changes are reasonable.
       
   322             
       
   323             // change the display name of the updated group in the current list
       
   324             (*iCurrentMembers)[ pos ]->SetGroupMemberDisplayNameL( info->GroupMemberDisplayName() );
       
   325 
       
   326             // found in current list, so it must be an updated list name
       
   327             iUpdated->InsertInOrderL( (*iCurrentMembers)[ pos ], linearOrder );
       
   328             }
       
   329         }
       
   330 
       
   331     // current list may get updated display name to the existing elements,
       
   332     // otherwise the list is unchanged. list of deleted groups stays empty.
       
   333     // updated and created lists were updated. the input parameter list can be
       
   334     // deleted
       
   335     CleanupStack::PopAndDestroy( tmp );
       
   336     iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
       
   337 
       
   338     InformObserversL();
       
   339     }
       
   340 
       
   341 // ---------------------------------------------------------------------------
       
   342 // CGroupContentSubscriptionItem::SetRemovedListL()
       
   343 // ---------------------------------------------------------------------------
       
   344 //
       
   345 EXPORT_C void CGroupContentSubscriptionItem::SetRemovedListL(
       
   346         RPrGrpMemInfoImpArray* aMemberList )
       
   347     {
       
   348     TRACE_1( _L("CGroupContentSubscriptionItem::SetRemovedListL() aMemberList Count=%d"), aMemberList->Count() );
       
   349     // we will eventually take ownership to this
       
   350     RPrGrpMemInfoImpArray* tmp = aMemberList;
       
   351     CleanupStack::PushL( tmp );
       
   352 
       
   353     // see also SetNewListL.
       
   354 
       
   355     // the list is already sorted. when a copy was made in datacacheimp, the
       
   356     // InsertInOrder method was used
       
   357     TLinearOrder<CPresentityGroupMemberInfoImp>
       
   358         linearOrder( CPresentityGroupMemberInfoImp::GroupIdLinearOrder );
       
   359 
       
   360     // remove the deleted ones from the current list
       
   361     for ( TInt i = 0; i < tmp->Count(); i++ )
       
   362         {
       
   363         // compare against current list
       
   364         CPresentityGroupMemberInfoImp* info = (*tmp)[ i ];
       
   365         TInt pos = iCurrentMembers->FindInOrder( info, linearOrder );
       
   366 
       
   367         // found in current list, so it must be a deleted list name
       
   368         if ( pos != KErrNotFound )
       
   369             {
       
   370             // remove from current list
       
   371             delete (*iCurrentMembers)[ pos ];
       
   372             iCurrentMembers->Remove( pos );
       
   373             }
       
   374         }
       
   375 
       
   376     // the given list becomes the new list of
       
   377     // removed ones
       
   378     delete iRemoved;
       
   379     iRemoved = tmp;
       
   380     CleanupStack::Pop( tmp );
       
   381     iSubscriptionState->SetDataStateL( MXIMPDataSubscriptionState::EDataAvailable );
       
   382     InformObserversL();
       
   383     }
       
   384 
       
   385 // ---------------------------------------------------------------------------
       
   386 // CGroupContentSubscriptionItem::Clean()
       
   387 // ---------------------------------------------------------------------------
       
   388 //
       
   389 EXPORT_C void CGroupContentSubscriptionItem::Clean()
       
   390     {
       
   391     TRACE( _L("CGroupContentSubscriptionItem::Clean") );
       
   392     // empty the lists.
       
   393     // the lists must stay valid for use
       
   394 
       
   395     // iAdded and iUpdated are collection from currentlist. Do not delete items.
       
   396     // iRemoved is only place for items. Delete those.
       
   397 
       
   398     iAdded->Reset();
       
   399     iUpdated->Reset();
       
   400     iRemoved->Close();
       
   401     }
       
   402 
       
   403 
       
   404 // ---------------------------------------------------------------------------
       
   405 // CGroupContentSubscriptionItem::GroupMemberExistsL()
       
   406 // ---------------------------------------------------------------------------
       
   407 //
       
   408 EXPORT_C TBool CGroupContentSubscriptionItem::GroupMemberExistsL(
       
   409                             CPresentityGroupMemberInfoImp& aMemberInfo ) const
       
   410     {
       
   411     TBool found( EFalse );
       
   412 
       
   413     CPresentityGroupMemberInfoImp* memberInfo =
       
   414         TXIMPObjectCloner< CPresentityGroupMemberInfoImp >::CloneL( aMemberInfo );
       
   415     CleanupStack::PushL( memberInfo );
       
   416 
       
   417 
       
   418     TLinearOrder<CPresentityGroupMemberInfoImp>
       
   419         linearOrder( CPresentityGroupMemberInfoImp::GroupIdLinearOrder );
       
   420     TInt pos = iCurrentMembers->FindInOrder( memberInfo, linearOrder );
       
   421     if ( pos != KErrNotFound )
       
   422         {
       
   423         found = ETrue;
       
   424         }
       
   425 
       
   426     CleanupStack::PopAndDestroy( memberInfo );
       
   427     TRACE_1( _L("CGroupContentSubscriptionItem::GroupMemberExistsL() returns=%d"), found );
       
   428     return found;
       
   429     }
       
   430 
       
   431 // ---------------------------------------------------------------------------
       
   432 // CGroupContentSubscriptionItem::IsGroupMemberUpdatedL()
       
   433 // ---------------------------------------------------------------------------
       
   434 //
       
   435 EXPORT_C TBool CGroupContentSubscriptionItem::IsGroupMemberUpdatedL(
       
   436                             CPresentityGroupMemberInfoImp& aMemberInfo ) const
       
   437     {
       
   438     TBool updated( EFalse );
       
   439 
       
   440     if ( !GroupMemberExistsL( aMemberInfo ) )
       
   441         {
       
   442         return updated;
       
   443         }
       
   444 
       
   445     CPresentityGroupMemberInfoImp* memberInfo =
       
   446         TXIMPObjectCloner< CPresentityGroupMemberInfoImp >::CloneL( aMemberInfo );
       
   447     CleanupStack::PushL( memberInfo );
       
   448 
       
   449 
       
   450     TLinearOrder<CPresentityGroupMemberInfoImp>
       
   451         linearOrder( CPresentityGroupMemberInfoImp::GroupIdLinearOrder );
       
   452     TInt pos = iCurrentMembers->FindInOrder( memberInfo, linearOrder );
       
   453     // it exists, otherwise we would've returned after GroupMemberExistsL call
       
   454 
       
   455     CPresentityGroupMemberInfoImp* foundMember = (*iCurrentMembers)[ pos ];
       
   456     // Compare identity and displayname
       
   457     if ( memberInfo->GroupMemberId().Identity().Compare(
       
   458                             foundMember->GroupMemberId().Identity() ) != 0
       
   459                             ||
       
   460          memberInfo->GroupMemberDisplayName().Compare(
       
   461                             foundMember->GroupMemberDisplayName() ) != 0 )
       
   462         {
       
   463         updated = ETrue;
       
   464         }
       
   465 
       
   466     CleanupStack::PopAndDestroy( memberInfo );
       
   467     TRACE_1( _L("CGroupContentSubscriptionItem::IsGroupMemberUpdatedL() returns=%d"), updated );
       
   468     return updated;
       
   469     }
       
   470 
       
   471 // ---------------------------------------------------------------------------
       
   472 // CGroupContentSubscriptionItem::MemberCount()
       
   473 // ---------------------------------------------------------------------------
       
   474 //
       
   475 TInt CGroupContentSubscriptionItem::MemberCount() const
       
   476     {
       
   477     TRACE_1( _L("CGroupContentSubscriptionItem::MemberCount() returns=%d"), iCurrentMembers->Count() );
       
   478     return iCurrentMembers->Count();
       
   479     }
       
   480 
       
   481 // ---------------------------------------------------------------------------
       
   482 // CGroupContentSubscriptionItem::MemberAt()
       
   483 // ---------------------------------------------------------------------------
       
   484 //
       
   485 CPresentityGroupMemberInfoImp& CGroupContentSubscriptionItem::MemberAt( TInt aIndex )
       
   486     {
       
   487     return *( *iCurrentMembers )[ aIndex ];
       
   488     }
       
   489 
       
   490 // ---------------------------------------------------------------------------
       
   491 // CGroupContentSubscriptionItem::RegisterEventObserverL()
       
   492 // ---------------------------------------------------------------------------
       
   493 //
       
   494 void CGroupContentSubscriptionItem::RegisterEventObserverL(
       
   495                         MGroupContentEventObserver* aEventObserver )
       
   496     {
       
   497     TInt indexOfObserver = iEventObservers.Find( aEventObserver );
       
   498     if( indexOfObserver == KErrNotFound )
       
   499         {
       
   500         iEventObservers.AppendL( aEventObserver );
       
   501         User::LeaveIfError( Open() );
       
   502         }
       
   503     }
       
   504 
       
   505 // ---------------------------------------------------------------------------
       
   506 // CGroupContentSubscriptionItem::UnregisterEventObserver()
       
   507 // ---------------------------------------------------------------------------
       
   508 //
       
   509 void CGroupContentSubscriptionItem::UnregisterEventObserver(
       
   510                         MGroupContentEventObserver* aEventObserver )
       
   511     {
       
   512     TInt indexOfObserver = iEventObservers.Find( aEventObserver );
       
   513     if( indexOfObserver != KErrNotFound )
       
   514         {
       
   515         iEventObservers.Remove( indexOfObserver );
       
   516         Close();
       
   517         }
       
   518     }
       
   519 
       
   520 // ---------------------------------------------------------------------------
       
   521 // CGroupContentSubscriptionItem::CleanExpired()
       
   522 // ---------------------------------------------------------------------------
       
   523 //
       
   524 void CGroupContentSubscriptionItem::CleanExpired()
       
   525     {
       
   526     }
       
   527 
       
   528 // ---------------------------------------------------------------------------
       
   529 // CGroupContentSubscriptionItem::InformObserversL()
       
   530 // ---------------------------------------------------------------------------
       
   531 //
       
   532 void CGroupContentSubscriptionItem::InformObserversL()
       
   533     {
       
   534     TInt count = iEventObservers.Count();
       
   535     if( count && ( iAdded->Count() || iRemoved->Count() ) )
       
   536         {
       
   537         for( TInt a = 0; a < count; ++a )
       
   538             {
       
   539             MGroupContentEventObserver* observer = iEventObservers[ a ];
       
   540             observer->HandleChangeL( *iAdded, *iRemoved );
       
   541             }
       
   542         }
       
   543     }
       
   544 
       
   545 // End of file