ccservices/cmsservices/cmsengine/Server/src/cmsservercontact.cpp
branchRCL_3
changeset 5 81f8547efd4f
parent 0 e686773b3f54
child 6 e8e3147d53eb
equal deleted inserted replaced
3:04ab22b956c2 5:81f8547efd4f
    28 #include <CVPbkContactFieldIterator.h>
    28 #include <CVPbkContactFieldIterator.h>
    29 #include <MVPbkContactFieldTextData.h>
    29 #include <MVPbkContactFieldTextData.h>
    30 #include <MVPbkContactFieldUriData.h>
    30 #include <MVPbkContactFieldUriData.h>
    31 #include <MVPbkContactStoreProperties.h>
    31 #include <MVPbkContactStoreProperties.h>
    32 #include <MVPbkContactOperationBase.h>
    32 #include <MVPbkContactOperationBase.h>
       
    33 #include <CVPbkTopContactManager.h>
    33 
    34 
    34 #include <featmgr.h>
    35 #include <featmgr.h>
    35 #include <crcseprofileregistry.h>
    36 #include <crcseprofileregistry.h>
    36 
    37 
    37 #include "bpas.h"
    38 #include "bpas.h"
   125     delete iCachedField8;
   126     delete iCachedField8;
   126     delete iAsyncContact;
   127     delete iAsyncContact;
   127     delete iCachedField16;
   128     delete iCachedField16;
   128     delete iBrandedPresence;
   129     delete iBrandedPresence;
   129     delete iPackedContactLinkArray;
   130     delete iPackedContactLinkArray;
       
   131     delete iOperation;
   130     iPresenceEvents.ResetAndDestroy();
   132     iPresenceEvents.ResetAndDestroy();
   131     iPhonebookEvents.ResetAndDestroy();
   133     iPhonebookEvents.ResetAndDestroy();
   132     iPresenceEvents.Close();
   134     iPresenceEvents.Close();
   133     iPhonebookEvents.Close();
   135     iPhonebookEvents.Close();
   134     iXSPFindOperationsArray.ResetAndDestroy();
   136     iXSPFindOperationsArray.ResetAndDestroy();
   196 // ----------------------------------------------------
   198 // ----------------------------------------------------
   197 // CCmsServerContact::OfferContactEventL
   199 // CCmsServerContact::OfferContactEventL
   198 // 
   200 // 
   199 // ----------------------------------------------------
   201 // ----------------------------------------------------
   200 //
   202 //
   201 TBool CCmsServerContact::OfferContactEventL( TCmsPhonebookEvent aEventType,
   203 void CCmsServerContact::OfferContactEventL( TCmsPhonebookEvent aEventType,
   202                                              const MVPbkContactLink* aContactLink )
   204                                              const MVPbkContactLink* aContactLink )
   203     {
   205     {
   204     PRINT( _L(" Start CCmsServerContact::OfferContactEventL()" ) );
   206     PRINT( _L(" Start CCmsServerContact::OfferContactEventL()" ) );
   205     
   207     
   206     TBuf<5> buffer( _L( "" ) );
   208     TBuf<5> buffer( _L( "" ) );
   207 
   209 
   208 		
       
   209     if ( !iContact )
   210     if ( !iContact )
   210     	{
   211     	{
   211 		buffer.AppendNum( aEventType );
   212 		buffer.AppendNum( aEventType );
   212         CCmsNotifyEvent* event = CCmsNotifyEvent::NewL( buffer, *this );
   213         CCmsNotifyEvent* event = CCmsNotifyEvent::NewL( buffer, *this );
   213         CleanupStack::PushL( event );
   214         CleanupStack::PushL( event );
   214         User::LeaveIfError( iPhonebookEvents.Append( event ) );
   215         User::LeaveIfError( iPhonebookEvents.Append( event ) );
   215         CleanupStack::Pop();  //event
   216         CleanupStack::Pop();  //event
   216             
   217         return;
   217     	return ETrue;
       
   218     	}
   218     	}
   219 
   219 
   220     TBool linkConsumed = EFalse;
       
   221     MVPbkContactLink* self = Contact().CreateLinkLC();
   220     MVPbkContactLink* self = Contact().CreateLinkLC();
   222     if( aContactLink && aContactLink->IsSame( *self ) )
   221     if( aContactLink && aContactLink->IsSame( *self ) )
   223         {
   222         {
   224         linkConsumed = ETrue;
       
   225         buffer.AppendNum( aEventType );
   223         buffer.AppendNum( aEventType );
   226         
   224         
   227         if( ECmsContactDeleted == aEventType )
   225         if( ECmsContactDeleted == aEventType )
   228             {
   226             {
   229             PRINT( _L( "CCmsServerContact::OfferContactEventL():  Contact deleted, invalidate this subsession" ) );
   227             PRINT( _L( "CCmsServerContact::OfferContactEventL():  Contact deleted, invalidate this subsession" ) );
   259             CleanupStack::Pop();  //event
   257             CleanupStack::Pop();  //event
   260             }
   258             }
   261         }
   259         }
   262     CleanupStack::PopAndDestroy();  //self
   260     CleanupStack::PopAndDestroy();  //self
   263     PRINT( _L(" End CCmsServerContact::OfferContactEventL()" ) );
   261     PRINT( _L(" End CCmsServerContact::OfferContactEventL()" ) );
   264     return linkConsumed;
       
   265     }
   262     }
   266 
   263 
   267 // ----------------------------------------------------
   264 // ----------------------------------------------------
   268 // CCmsServerContact::IsDeleted
   265 // CCmsServerContact::IsDeleted
   269 // 
   266 // 
  1447     SendOrQueueBrandedDataL( buffer->Ptr(0) );    
  1444     SendOrQueueBrandedDataL( buffer->Ptr(0) );    
  1448     CleanupStack::PopAndDestroy( buffer );    
  1445     CleanupStack::PopAndDestroy( buffer );    
  1449     CleanupStack::PopAndDestroy( data );    
  1446     CleanupStack::PopAndDestroy( data );    
  1450 	}
  1447 	}
  1451 
  1448 
       
  1449 // ----------------------------------------------------------
       
  1450 // CCmsServerContact::IsTopContactL
       
  1451 // 
       
  1452 // ----------------------------------------------------------
       
  1453 //
       
  1454 void CCmsServerContact::IsTopContactL( const RMessage2& aMessage )
       
  1455     {
       
  1456     PRINT( _L(" Start CCmsServerContact::IsTopContactL()" ) );    
       
  1457     
       
  1458     __ASSERT_DEBUG( iContact, CCmsServer::PanicServer( ENullContactHandle ) );    
       
  1459     
       
  1460     TBool isFav( EFalse );
       
  1461     isFav = CVPbkTopContactManager::IsTopContact( *iContact );
       
  1462     
       
  1463     TPckgC<TInt> isTopContact( isFav );        
       
  1464     aMessage.WriteL( KFirstParam, isTopContact );       
       
  1465     
       
  1466     aMessage.Complete( KErrNone );
       
  1467     
       
  1468     PRINT( _L(" End CCmsServerContact::IsTopContactL()" ) );                 
       
  1469     }
       
  1470 // ----------------------------------------------------
       
  1471 // CCmsServerContact::VPbkSingleContactOperationComplete
       
  1472 // 
       
  1473 // ----------------------------------------------------
       
  1474 //
       
  1475 void CCmsServerContact::VPbkSingleContactOperationComplete(
       
  1476         MVPbkContactOperationBase& /*aOperation*/,
       
  1477         MVPbkStoreContact* aContact )
       
  1478     {
       
  1479     TRAPD( res, ContactReadyL( KErrNone, aContact ) );
       
  1480     iCmsServer.CmsSingleContactOperationComplete( res );
       
  1481     }
       
  1482 
       
  1483 // ----------------------------------------------------
       
  1484 // CCmsServerContact::VPbkSingleContactOperationFailed
       
  1485 // 
       
  1486 // ----------------------------------------------------
       
  1487 //
       
  1488 void CCmsServerContact::VPbkSingleContactOperationFailed(
       
  1489         MVPbkContactOperationBase& /*aOperation*/,
       
  1490         TInt aError )
       
  1491     {
       
  1492     TRAP_IGNORE ( ContactReadyL( aError, NULL ) );
       
  1493     iCmsServer.CmsSingleContactOperationComplete( aError );
       
  1494     }
       
  1495 
       
  1496 // ----------------------------------------------------
       
  1497 // CCmsServerContact::FetchContactL
       
  1498 // 
       
  1499 // ----------------------------------------------------
       
  1500 //
       
  1501 void CCmsServerContact::FetchContactL( MVPbkContactLink* aContactLinkToFetch )
       
  1502     {
       
  1503     if( iOperation )
       
  1504         {
       
  1505         delete iOperation;
       
  1506         iOperation = NULL;
       
  1507         }
       
  1508     iOperation = iContactManager->RetrieveContactL( *aContactLinkToFetch, *this );
       
  1509     }
  1452 // End of File
  1510 // End of File