realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileServerCore.cpp
branchRCL_3
changeset 16 43c4dec3cb1f
parent 12 c2e8c8b73582
child 19 8517a9ac4a23
--- a/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileServerCore.cpp	Wed Apr 14 16:19:40 2010 +0300
+++ b/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileServerCore.cpp	Tue Apr 27 17:00:49 2010 +0300
@@ -760,7 +760,7 @@
         {
         CSIPConcreteProfile* defaultProfile = FindDefaultProfile();
         
-        if ( defaultProfile && defaultProfile != aProfile )
+        if ( defaultProfile && defaultProfile->Id() != aProfile->Id() )
         	{
         	defaultProfile->SetDefault( EFalse );
         	}
@@ -786,6 +786,22 @@
     return NULL;
     }
 
+// ----------------------------------------------------------------------------------
+// CSIPProfileServerCore::Profile. Returns modifiable ConcreteProfile object pointer
+// ----------------------------------------------------------------------------------
+//
+CSIPConcreteProfile*
+CSIPProfileServerCore::Profile(TUint32 aProfileId)
+    {
+    CSIPProfileCacheItem* item = ProfileCacheItem(aProfileId);
+    if (item)
+        {
+        return &item->Profile();
+        }
+    return NULL;
+    }
+
+
 // -----------------------------------------------------------------------------
 // CSIPProfileServerCore::ProfileDefaultL
 // -----------------------------------------------------------------------------
@@ -1076,7 +1092,7 @@
                              && item->IsVpnInUse());
     
     const CSIPConcreteProfile* profile = Profile(aProfileId);
-    if(FeatureManager::FeatureSupported( KFeatureIdFfSipApnSwitching ) 
+    if(profile && FeatureManager::FeatureSupported( KFeatureIdFfSipApnSwitching ) 
         && CheckApnSwitchEnabledL( *profile ) && !item->IsRfsInprogress() && !isVpnInUse )
         {
         PROFILE_DEBUG1("CSIPProfileServerCore::EnableProfileL, SwichEnabled")
@@ -1140,7 +1156,7 @@
     if(CSIPConcreteProfile::EUnregistered != item->UsedProfile().Status())
     	{
     	PROFILE_DEBUG3("CSIPProfileServerCore::ForceDisableProfileL, Forcibly disabling profile", aProfileId);
-    	item->SwitchToUnregisteredState();
+    	item->SwitchToUnregisteredState(EFalse);
     	iPluginDirector->TerminateHandling(item->UsedProfile());
     	item->ClearMigrationProfiles();
     	iPluginDirector->StartTimerForCleanup();
@@ -2167,27 +2183,30 @@
                 TInt error(KErrNone);
                 PROFILE_DEBUG3("CSIPProfileServerCore::ApnChanged, Profile Id", profile->Id())
                 CSIPProfileCacheItem* item = ProfileCacheItem(profile->Id());
-                TBool isVpnInUse = (FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )
-                                             && item->IsVpnInUse());
-                if ( err == KErrNone && CheckIapSettings(profile->Id()))
+                if(item)
                     {
-                    if(switchEnabledProfile.operation == TStoreSwitchEnabledProfile::Update)
-                        {
-                        TRAP(error, item->UpdateRegistrationL(*(switchEnabledProfile.iObserver)));
-                        }
-                    else if(switchEnabledProfile.operation == TStoreSwitchEnabledProfile::Enable && !item->IsRfsInprogress() && !isVpnInUse)                    
-                        {
-                        TRAP(error, iAlrHandler->EnableProfileL(*item, *(switchEnabledProfile.iObserver)));
-                        }
-                    else if(switchEnabledProfile.operation == TStoreSwitchEnabledProfile::Register)
-                        {
-                        TRAP(error, item->StartRegisterL(*iWaitForIAP, *iRegInProg, ETrue));
-                        }
-                    }
-                if ( err != KErrNone || error)
-                    {
-                     PROFILE_DEBUG1("CSIPProfileServerCore::ApnChanged, error handling")
-                     HandleAsyncError(*item, profile->Status(), err);
+	                TBool isVpnInUse = (FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )
+	                                             && item->IsVpnInUse());
+	                if ( err == KErrNone && CheckIapSettings(profile->Id()))
+	                    {
+	                    if(switchEnabledProfile.operation == TStoreSwitchEnabledProfile::Update)
+	                        {
+	                        TRAP(error, item->UpdateRegistrationL(*(switchEnabledProfile.iObserver)));
+	                        }
+	                    else if(switchEnabledProfile.operation == TStoreSwitchEnabledProfile::Enable && !item->IsRfsInprogress() && !isVpnInUse)                    
+	                        {
+	                        TRAP(error, iAlrHandler->EnableProfileL(*item, *(switchEnabledProfile.iObserver)));
+	                        }
+	                    else if(switchEnabledProfile.operation == TStoreSwitchEnabledProfile::Register)
+	                        {
+	                        TRAP(error, item->StartRegisterL(*iWaitForIAP, *iRegInProg, ETrue));
+	                        }
+	                    }
+	                if ( err != KErrNone || error)
+	                    {
+	                     PROFILE_DEBUG1("CSIPProfileServerCore::ApnChanged, error handling")
+	                     HandleAsyncError(*item, profile->Status(), err);
+	                    }
                     }
                 }
             }