36 #include <spsettings.h> // For Service Provider Settings. |
36 #include <spsettings.h> // For Service Provider Settings. |
37 #include <spentry.h> // For Service Provider Settings. |
37 #include <spentry.h> // For Service Provider Settings. |
38 #include <spproperty.h> // For Service Provider Settings. |
38 #include <spproperty.h> // For Service Provider Settings. |
39 #include <featmgr.h> |
39 #include <featmgr.h> |
40 #include <nsmldmiapmatcher.h> // For fetching IAP. |
40 #include <nsmldmiapmatcher.h> // For fetching IAP. |
|
41 #include <nsmldmuri.h> // for parsing uris |
41 #include <pathinfo.h> // For getting phone rom root path. |
42 #include <pathinfo.h> // For getting phone rom root path. |
42 #include <cvimpstsettingsstore.h> // For IM tone path |
43 #include <cvimpstsettingsstore.h> // For IM tone path |
|
44 #include <pressettingsset.h> // for checking if presence settings is valid |
|
45 #include <pressettingsapi.h> // for checking if presence settings is valid |
43 |
46 |
44 #include "nsmldmvoipadapter.h" |
47 #include "nsmldmvoipadapter.h" |
45 #include "cdmvoipspsettings.h" |
48 #include "cdmvoipspsettings.h" |
46 #include "CSIPProfileRegistryObserver.h" // For SIP User Agent Header. |
49 #include "CSIPProfileRegistryObserver.h" // For SIP User Agent Header. |
47 #include "cipappphoneutils.h" // For GetPhoneModelL, GetTerminalTypeL |
50 #include "cipappphoneutils.h" // For GetPhoneModelL, GetTerminalTypeL |
4355 } |
4358 } |
4356 |
4359 |
4357 sipProfReg->SaveL( *sipManProf ); |
4360 sipProfReg->SaveL( *sipManProf ); |
4358 uahArray->Reset(); |
4361 uahArray->Reset(); |
4359 // uahArray, sipManProf |
4362 // uahArray, sipManProf |
4360 CleanupStack::PopAndDestroy( 2, sipManProf ); // CS:2 |
4363 CleanupStack::PopAndDestroy( uahArray ); // CS:3 |
|
4364 CleanupStack::PopAndDestroy( sipManProf ); // CS:2 |
4361 }// if |
4365 }// if |
4362 // sipProfReg, sipRegObs |
4366 // sipProfReg, sipRegObs |
4363 CleanupStack::PopAndDestroy( 2, sipRegObs ); // CS:0 |
4367 CleanupStack::PopAndDestroy( sipProfReg ); // CS:1 |
|
4368 CleanupStack::PopAndDestroy( sipRegObs ); // CS:0 |
4364 sipProf = NULL; |
4369 sipProf = NULL; |
4365 }// if |
4370 }// if |
4366 }// for |
4371 }// for |
4367 iCRCSEProfile->UpdateL( |
4372 iCRCSEProfile->UpdateL( |
4368 iProfileEntries[iProfileModifs[counter]]->iId, |
4373 iProfileEntries[iProfileModifs[counter]]->iId, |
5369 if ( luid->Des().Length() && |
5377 if ( luid->Des().Length() && |
5370 aProfileId == DesToTUint( LastURISeg( luid->Des() ) ) ) |
5378 aProfileId == DesToTUint( LastURISeg( luid->Des() ) ) ) |
5371 { |
5379 { |
5372 aObject.Copy( uri->Des() ); |
5380 aObject.Copy( uri->Des() ); |
5373 // luid, uri |
5381 // luid, uri |
5374 CleanupStack::PopAndDestroy( 2, uri ); // CS:2 |
5382 CleanupStack::PopAndDestroy( luid ); // CS:3 |
|
5383 CleanupStack::PopAndDestroy( uri ); // CS:2 |
5375 break; |
5384 break; |
5376 } |
5385 } |
5377 // luid, uri |
5386 // luid, uri |
5378 CleanupStack::PopAndDestroy( 2, uri ); // CS:2 |
5387 CleanupStack::PopAndDestroy( luid ); // CS:3 |
|
5388 CleanupStack::PopAndDestroy( uri ); // CS:2 |
5379 childList->Des().Copy( RemoveLastURISeg( childList->Des() ) ); |
5389 childList->Des().Copy( RemoveLastURISeg( childList->Des() ) ); |
5380 } |
5390 } |
5381 |
5391 |
5382 // childList, result |
5392 // childList, result |
5383 CleanupStack::PopAndDestroy( 2, result ); // CS:0 |
5393 CleanupStack::PopAndDestroy( childList ); // CS:1 |
|
5394 CleanupStack::PopAndDestroy( result ); // CS:0 |
5384 DBG_PRINT("CNSmlDmVoIPAdapter::GetNatFwUriL : end"); |
5395 DBG_PRINT("CNSmlDmVoIPAdapter::GetNatFwUriL : end"); |
5385 return errorStatus; |
5396 return errorStatus; |
5386 } |
5397 } |
5387 |
5398 |
5388 // --------------------------------------------------------------------------- |
5399 // --------------------------------------------------------------------------- |
5507 if ( luid->Des().Length() && |
5519 if ( luid->Des().Length() && |
5508 aProfileId == DesToTUint( LastURISeg( luid->Des() ) ) ) |
5520 aProfileId == DesToTUint( LastURISeg( luid->Des() ) ) ) |
5509 { |
5521 { |
5510 aObject.Copy( uri->Des() ); |
5522 aObject.Copy( uri->Des() ); |
5511 // luid, uri |
5523 // luid, uri |
5512 CleanupStack::PopAndDestroy( 2, uri ); // CS:2 |
5524 CleanupStack::PopAndDestroy( luid ); // CS:3 |
|
5525 CleanupStack::PopAndDestroy( uri ); // CS:2 |
5513 break; |
5526 break; |
5514 } |
5527 } |
5515 childList->Des().Copy( RemoveLastURISeg( childList->Des() ) ); |
5528 childList->Des().Copy( RemoveLastURISeg( childList->Des() ) ); |
5516 // luid, uri |
5529 // luid, uri |
5517 CleanupStack::PopAndDestroy( 2, uri ); // CS:2 |
5530 CleanupStack::PopAndDestroy( luid ); // CS:3 |
|
5531 CleanupStack::PopAndDestroy( uri ); // CS:2 |
5518 } |
5532 } |
5519 // childList, result |
5533 // childList, result |
5520 CleanupStack::PopAndDestroy( 2, result ); // CS:0 |
5534 CleanupStack::PopAndDestroy( childList ); // CS:1 |
|
5535 CleanupStack::PopAndDestroy( result ); // CS:0 |
5521 DBG_PRINT("CNSmlDmVoIPAdapter::GetPresenceUriL : end"); |
5536 DBG_PRINT("CNSmlDmVoIPAdapter::GetPresenceUriL : end"); |
5522 return errorStatus; |
5537 return errorStatus; |
5523 } |
5538 } |
5524 |
5539 |
5525 // --------------------------------------------------------------------------- |
5540 // --------------------------------------------------------------------------- |
5527 // Get Presence profile ID. |
5542 // Get Presence profile ID. |
5528 // --------------------------------------------------------------------------- |
5543 // --------------------------------------------------------------------------- |
5529 // |
5544 // |
5530 TUint32 CNSmlDmVoIPAdapter::PresenceIdL( const TDesC8& aObject ) const |
5545 TUint32 CNSmlDmVoIPAdapter::PresenceIdL( const TDesC8& aObject ) const |
5531 { |
5546 { |
5532 DBG_PRINT("CNSmlDmVoIPAdapter::PresenceIdL : begin"); |
5547 #ifdef _DEBUG |
|
5548 TBuf<KMaxDebugPrintLength> object; |
|
5549 object.Copy( aObject ); |
|
5550 DBG_PRINT2("CNSmlDmVoIPAdapter::PresenceIdL : begin uri: %S", &object ); |
|
5551 #endif |
5533 |
5552 |
5534 __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) ); |
5553 __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) ); |
5535 |
5554 TPtrC8 uri = RemoveDotSlash( aObject ); |
5536 HBufC8* luid = HBufC8::NewLC( KMaxUriLength ); // CS:1 |
5555 |
5537 luid->Des().Copy( iDmCallback->GetLuidAllocL( aObject )->Des() ); |
5556 HBufC8* luid = iDmCallback->GetLuidAllocL( uri ); |
5538 if ( luid->Des().Length() ) |
5557 CleanupStack::PushL( luid ); //CS:1 |
5539 { |
5558 |
5540 TUint32 profileId = DesToTUint( LastURISeg( luid->Des() ) ); |
5559 // check whether above found id is valid or not |
|
5560 TUint32 profileId; |
|
5561 if ( luid->Length() == KErrNone ) |
|
5562 { |
|
5563 //try to find it another way |
|
5564 if( NSmlDmURI::NumOfURISegs( uri ) > 1 ) |
|
5565 { |
|
5566 TPtrC8 idSegment = NSmlDmURI::URISeg( uri, 2 ); |
|
5567 TBuf<KMaxDebugPrintLength> tempSegment; |
|
5568 tempSegment.Copy( idSegment ); |
|
5569 DBG_PRINT2("CNSmlDmVoIPAdapter::PresenceIdL - idSegment:%S", &tempSegment ); |
|
5570 profileId = DesToTUint(idSegment); |
|
5571 if(!IsPresIDValidL(profileId)) |
|
5572 { |
|
5573 CleanupStack::PopAndDestroy( luid ); // CS:0 |
|
5574 DBG_PRINT("CNSmlDmVoIPAdapter::PresenceIdL : ID not valid - return KErrNone"); |
|
5575 return KErrNone; |
|
5576 } |
|
5577 CleanupStack::PopAndDestroy( luid ); // CS:0 |
|
5578 DBG_PRINT2("CNSmlDmVoIPAdapter::PresenceIdL - settingsId found local way:%d", profileId); |
|
5579 return profileId; |
|
5580 } |
5541 CleanupStack::PopAndDestroy( luid ); // CS:0 |
5581 CleanupStack::PopAndDestroy( luid ); // CS:0 |
5542 DBG_PRINT("CNSmlDmVoIPAdapter::PresenceIdL : end"); |
5582 DBG_PRINT("CNSmlDmVoIPAdapter::PresenceIdL : ID not valid, too short uri"); |
5543 return profileId; |
5583 return KErrNone; |
5544 } |
5584 } |
|
5585 profileId = DesToTUint( *luid ); |
5545 CleanupStack::PopAndDestroy( luid ); // CS:0 |
5586 CleanupStack::PopAndDestroy( luid ); // CS:0 |
5546 DBG_PRINT("CNSmlDmVoIPAdapter::PresenceIdL : end"); |
5587 DBG_PRINT2("CNSmlDmVoIPAdapter::PresenceIdL : return profleId: %d", profileId ); |
5547 return KErrNone; |
5588 return profileId; |
|
5589 } |
|
5590 |
|
5591 // ----------------------------------------------------------------------------- |
|
5592 // CPresenceDMAdapter::IsPresIDValidL |
|
5593 // ----------------------------------------------------------------------------- |
|
5594 // |
|
5595 TBool CNSmlDmVoIPAdapter::IsPresIDValidL( TUint32 aSetId ) const |
|
5596 { |
|
5597 TPresSettingsSet tempSet; |
|
5598 if ((PresSettingsApi::SettingsSetL( (TInt)aSetId,tempSet)) == KErrNone) |
|
5599 return ETrue; |
|
5600 DBG_PRINT2(" CNSmlDmVoIPAdapter::IsPresIDValidL - Invalid settings : %d", aSetId ); |
|
5601 return EFalse; |
5548 } |
5602 } |
5549 |
5603 |
5550 // --------------------------------------------------------------------------- |
5604 // --------------------------------------------------------------------------- |
5551 // CNSmlDmVoIPAdapter::SnapIdL |
5605 // CNSmlDmVoIPAdapter::SnapIdL |
5552 // Gets SNAP ID based on URI. |
5606 // Gets SNAP ID based on URI. |
5618 if ( luid->Des().Length() && |
5672 if ( luid->Des().Length() && |
5619 aSnapId == DesToInt( LastURISeg( luid->Des() ) ) ) |
5673 aSnapId == DesToInt( LastURISeg( luid->Des() ) ) ) |
5620 { |
5674 { |
5621 aObject.Copy( uri->Des() ); |
5675 aObject.Copy( uri->Des() ); |
5622 // luid, uri |
5676 // luid, uri |
5623 CleanupStack::PopAndDestroy( 2, uri ); // CS:2 |
5677 CleanupStack::PopAndDestroy( luid ); // CS:3 |
|
5678 CleanupStack::PopAndDestroy( uri ); // CS:2 |
5624 break; |
5679 break; |
5625 } |
5680 } |
5626 childList->Des().Copy( RemoveLastURISeg( childList->Des() ) ); |
5681 childList->Des().Copy( RemoveLastURISeg( childList->Des() ) ); |
5627 // luid, uri |
5682 // luid, uri |
5628 CleanupStack::PopAndDestroy( 2, uri ); // CS:2 |
5683 CleanupStack::PopAndDestroy( luid ); // CS:3 |
|
5684 CleanupStack::PopAndDestroy( uri ); // CS:2 |
5629 } |
5685 } |
5630 // childList, result |
5686 // childList, result |
5631 CleanupStack::PopAndDestroy( 2, result ); // CS:0 |
5687 CleanupStack::PopAndDestroy( childList ); // CS:1 |
|
5688 CleanupStack::PopAndDestroy( result ); // CS:0 |
5632 DBG_PRINT( "CNSmlDmVoIPAdapter::GetSnapUriL - end" ); |
5689 DBG_PRINT( "CNSmlDmVoIPAdapter::GetSnapUriL - end" ); |
5633 return status; |
5690 return status; |
5634 } |
5691 } |
5635 |
5692 |
5636 // End of file. |
5693 // End of file. |