48 #include "cmsserverxspcontacthandler.h" |
48 #include "cmsserverxspcontacthandler.h" |
49 #include "mpresencetrafficlights.h" |
49 #include "mpresencetrafficlights.h" |
50 #include "cmsserverdefines.h" |
50 #include "cmsserverdefines.h" |
51 #include "cmsdebug.h" |
51 #include "cmsdebug.h" |
52 |
52 |
|
53 /// Definition of non-parsed VoIP features |
|
54 const TInt KVoIPFeaturesUndefined = KMinTInt; |
|
55 |
53 // ---------------------------------------------------- |
56 // ---------------------------------------------------- |
54 // CCmsServerContact::CCmsServerContact |
57 // CCmsServerContact::CCmsServerContact |
55 // |
58 // |
56 // ---------------------------------------------------- |
59 // ---------------------------------------------------- |
57 // |
60 // |
58 CCmsServerContact::CCmsServerContact( CCmsServerSession& aSession, |
61 CCmsServerContact::CCmsServerContact( CCmsServerSession& aSession, |
59 CCmsServer& aCmsServer ) : |
62 CCmsServer& aCmsServer ) : |
60 iContactDeleted( EFalse ), |
63 iContactDeleted( EFalse ), |
61 iPresenceNotifySubscribed( EFalse ), |
64 iPresenceNotifySubscribed( EFalse ), |
62 iSession( aSession ), |
65 iSession( aSession ), |
63 iCmsServer( aCmsServer ) |
66 iCmsServer( aCmsServer ), |
|
67 iVoipFeatures( KVoIPFeaturesUndefined ) |
64 { |
68 { |
65 } |
69 } |
66 |
70 |
67 // ---------------------------------------------------- |
71 // ---------------------------------------------------- |
68 // CCmsServerContact::NewL |
72 // CCmsServerContact::NewL |
115 if ( iChatHandler ) |
119 if ( iChatHandler ) |
116 { |
120 { |
117 iChatHandler->UnsubscribeBrandingForContact( iContactLink, this ); |
121 iChatHandler->UnsubscribeBrandingForContact( iContactLink, this ); |
118 } |
122 } |
119 } |
123 } |
120 delete iContact; |
124 |
121 iContact = NULL; |
|
122 |
|
123 iCmsServer.PhonebookProxyHandle().SetContact( iContact ); |
|
124 |
|
125 delete iStoreUri; |
125 delete iStoreUri; |
126 delete iChatHandler; |
126 delete iChatHandler; |
127 delete iVoipHandler; |
127 delete iVoipHandler; |
128 delete iXSPContactHandler; |
128 delete iXSPContactHandler; |
129 delete iContactLink; |
129 delete iContactLink; |
|
130 delete iContact; |
|
131 iContact = NULL; |
|
132 |
|
133 |
|
134 iCmsServer.PhonebookProxyHandle().SetContact( iContact ); |
|
135 |
130 delete iCachedField8; |
136 delete iCachedField8; |
131 delete iAsyncContact; |
137 delete iAsyncContact; |
132 delete iCachedField16; |
138 delete iCachedField16; |
133 delete iBrandedPresence; |
139 delete iBrandedPresence; |
134 delete iPackedContactLinkArray; |
140 delete iPackedContactLinkArray; |
635 // ---------------------------------------------------- |
641 // ---------------------------------------------------- |
636 // |
642 // |
637 void CCmsServerContact::ContactReadyL( TInt aError, MVPbkStoreContact* aContact ) |
643 void CCmsServerContact::ContactReadyL( TInt aError, MVPbkStoreContact* aContact ) |
638 { |
644 { |
639 TPtrC uri( _L( "" ) ); |
645 TPtrC uri( _L( "" ) ); |
|
646 |
|
647 delete iContact; |
|
648 iContact = aContact; |
|
649 if( !iContact ) |
|
650 { |
|
651 iContactDeleted = ETrue; |
|
652 } |
|
653 else |
|
654 { |
|
655 iContactDeleted = EFalse; |
|
656 } |
|
657 |
|
658 iCmsServer.PhonebookProxyHandle().SetContact( iContact ); |
|
659 |
640 if( KErrNone == aError && aContact ) |
660 if( KErrNone == aError && aContact ) |
641 { |
661 { |
642 delete iContact; |
|
643 iContact = aContact; |
|
644 //Create contactlink array of this contact. This is needed for UI operations. |
662 //Create contactlink array of this contact. This is needed for UI operations. |
645 //Only 1 contact link appended to array. |
663 //Only 1 contact link appended to array. |
646 //Possible performance issue. Should this be created only when array is requested from client side? |
664 //Possible performance issue. Should this be created only when array is requested from client side? |
647 CreateContactLinkArrayL(); |
665 CreateContactLinkArrayL(); |
648 uri.Set( aContact->ParentStore().StoreProperties().Uri().UriDes() ); |
666 uri.Set( aContact->ParentStore().StoreProperties().Uri().UriDes() ); |
649 ParseContactStore( uri ); |
667 ParseContactStore( uri ); |
650 |
668 |
651 iCmsServer.PhonebookProxyHandle().SetContact( iContact ); |
669 iVoipFeatures = KVoIPFeaturesUndefined; // reset VoIP cache |
652 } |
670 } |
653 } |
671 } |
654 |
672 |
655 // ---------------------------------------------------------- |
673 // ---------------------------------------------------------- |
656 // CCmsServerContact::ParseContactStore |
674 // CCmsServerContact::ParseContactStore |
1310 // |
1328 // |
1311 TInt CCmsServerContact::ParseVoIPAvailabilityL() |
1329 TInt CCmsServerContact::ParseVoIPAvailabilityL() |
1312 { |
1330 { |
1313 PRINT( _L( "Start CCmsServerContact::ParseVoIPAvailabilityL()" ) ); |
1331 PRINT( _L( "Start CCmsServerContact::ParseVoIPAvailabilityL()" ) ); |
1314 |
1332 |
1315 TInt bitter( 0 ); |
1333 if( iVoipFeatures == KVoIPFeaturesUndefined ) |
1316 TBool found( EFalse ); |
1334 { |
1317 |
1335 iVoipFeatures = 0; // no features |
1318 if( CmsServerUtils::IsVoIPSupportedL() ) |
1336 if( CmsServerUtils::IsVoIPSupportedL() ) |
1319 { |
1337 { |
1320 bitter |= ECmsVoIPSupportBasic; |
1338 iVoipFeatures = ECmsVoIPSupportBasic; |
1321 CheckServiceProviderSupportL( bitter ); |
1339 CheckServiceProviderSupportL( iVoipFeatures ); |
1322 |
1340 |
1323 CSPSettings* settings = CSPSettings::NewLC(); |
1341 CSPSettings* settings = CSPSettings::NewLC(); |
1324 |
1342 |
1325 if ( FeatureManager::FeatureSupported(KFeatureIdCommonVoip) ) |
1343 if ( FeatureManager::FeatureSupported(KFeatureIdCommonVoip) ) |
1326 { |
|
1327 RIdArray idArray; |
|
1328 CleanupClosePushL(idArray); |
|
1329 User::LeaveIfError( settings->FindServiceIdsL(idArray) ); |
|
1330 |
|
1331 CRCSEProfileRegistry* profileRegistry = CRCSEProfileRegistry::NewLC(); |
|
1332 RPointerArray<CRCSEProfileEntry> entries; |
|
1333 CleanupStack::PushL( TCleanupItem(CleanupResetAndDestroy, &entries) ); |
|
1334 |
|
1335 // Check if we have atleast one SPSetting entry |
|
1336 // Any entry in this array uses SIP protocol for VoIP |
|
1337 for (TInt i = 0; !found && i < idArray.Count(); ++i) |
|
1338 { |
1344 { |
1339 profileRegistry->FindByServiceIdL( idArray[i], entries ); |
1345 RIdArray idArray; |
1340 if (entries.Count() > 0) |
1346 CleanupClosePushL(idArray); |
|
1347 User::LeaveIfError( settings->FindServiceIdsL(idArray) ); |
|
1348 CRCSEProfileRegistry& profileRegistry = iCmsServer.RCSEProfileRegistryL(); |
|
1349 RPointerArray<CRCSEProfileEntry> entries; |
|
1350 CleanupStack::PushL( TCleanupItem(CleanupResetAndDestroy, &entries) ); |
|
1351 |
|
1352 // Check if we have atleast one SPSetting entry |
|
1353 // Any entry in this array uses SIP protocol for VoIP |
|
1354 for (TInt i = 0; i < idArray.Count(); ++i) |
1341 { |
1355 { |
1342 bitter |= ECmsVoIPSupportSip; |
1356 profileRegistry.FindByServiceIdL( idArray[i], entries ); |
1343 found = ETrue; |
1357 if (entries.Count() > 0) |
|
1358 { |
|
1359 iVoipFeatures |= ECmsVoIPSupportSip; |
|
1360 break; |
|
1361 } |
1344 } |
1362 } |
|
1363 |
|
1364 CleanupStack::PopAndDestroy( 2 ); //entries, idArray, |
1345 } |
1365 } |
1346 |
1366 |
1347 CleanupStack::PopAndDestroy( 3 ); //entries, profileRegistry, idArray, |
1367 if( settings->IsFeatureSupported( ESupportCallOutFeature ) ) |
1348 } |
1368 { |
1349 |
1369 iVoipFeatures |= ECmsVoIPSupportCallout; |
1350 if( settings->IsFeatureSupported( ESupportCallOutFeature ) ) |
1370 } |
1351 { |
1371 |
1352 bitter |= ECmsVoIPSupportCallout; |
1372 CleanupStack::PopAndDestroy(); // settings |
1353 } |
1373 } |
1354 |
|
1355 CleanupStack::PopAndDestroy(); // settings |
|
1356 |
|
1357 |
|
1358 } |
1374 } |
1359 PRINT( _L( "End CCmsServerContact::ParseVoIPAvailabilityL()" ) ); |
1375 PRINT( _L( "End CCmsServerContact::ParseVoIPAvailabilityL()" ) ); |
1360 return bitter; |
1376 return iVoipFeatures; |
1361 } |
1377 } |
1362 |
1378 |
1363 // ---------------------------------------------------- |
1379 // ---------------------------------------------------- |
1364 // CCmsServerContact::StartNextFindOperationL |
1380 // CCmsServerContact::StartNextFindOperationL |
1365 // |
1381 // |
1493 // ---------------------------------------------------- |
1509 // ---------------------------------------------------- |
1494 // |
1510 // |
1495 void CCmsServerContact::VPbkSingleContactOperationFailed( |
1511 void CCmsServerContact::VPbkSingleContactOperationFailed( |
1496 MVPbkContactOperationBase& /*aOperation*/, |
1512 MVPbkContactOperationBase& /*aOperation*/, |
1497 TInt aError ) |
1513 TInt aError ) |
1498 { |
1514 { |
1499 TRAP_IGNORE ( ContactReadyL( aError, NULL ) ); |
|
1500 iCmsServer.CmsSingleContactOperationComplete( aError ); |
1515 iCmsServer.CmsSingleContactOperationComplete( aError ); |
1501 } |
1516 } |
1502 |
1517 |
1503 // ---------------------------------------------------- |
1518 // ---------------------------------------------------- |
1504 // CCmsServerContact::FetchContactL |
1519 // CCmsServerContact::FetchContactL |