realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileServerCore.cpp
branchRCL_3
changeset 19 8517a9ac4a23
parent 16 43c4dec3cb1f
child 20 a7d1e54a7332
equal deleted inserted replaced
16:43c4dec3cb1f 19:8517a9ac4a23
   620         for (TInt i = 0; i < infoArray.Count(); i ++)
   620         for (TInt i = 0; i < infoArray.Count(); i ++)
   621             {
   621             {
   622             CImplementationInformation* ecomInfo = infoArray[i];
   622             CImplementationInformation* ecomInfo = infoArray[i];
   623             TSIPProfileTypeInfo info;
   623             TSIPProfileTypeInfo info;
   624             ConvertTypeInfoL(*ecomInfo, info);
   624             ConvertTypeInfoL(*ecomInfo, info);
   625             array.AppendL(info);
   625             TIdentityRelation<TSIPProfileTypeInfo> identityRelation(CSIPProfileServerCore::Compare);
       
   626             TInt alreadyExits = array.Find(info,identityRelation);
       
   627             if(alreadyExits == KErrNotFound)
       
   628                 {
       
   629                 array.AppendL(info);
       
   630                 }
   626             }
   631             }
   627         }
   632         }
   628     CleanupStack::Pop(&infoArray);
   633     CleanupStack::Pop(&infoArray);
   629     infoArray.ResetAndDestroy();
   634     infoArray.ResetAndDestroy();
   630     infoArray.Close();
   635     infoArray.Close();
  1065                 updateProfile.operation = TStoreSwitchEnabledProfile::Update;
  1070                 updateProfile.operation = TStoreSwitchEnabledProfile::Update;
  1066                 iWaitForApnSettings.AppendL(updateProfile);
  1071                 iWaitForApnSettings.AppendL(updateProfile);
  1067                 }
  1072                 }
  1068             }
  1073             }
  1069         else
  1074         else
  1070             User::LeaveIfError(KErrNotSupported);
  1075             {
       
  1076             // At this point the registration has failed fatally already and profile will be in 
       
  1077             // unregistered state. Since we cann't do any regisrtation related activity and 
       
  1078             // not to lose user's updated data we are doing this.
       
  1079             if(item->UsedProfile().Status() == CSIPConcreteProfile::EUnregistered)
       
  1080                 {
       
  1081                 item->ClearOldProfile();
       
  1082                 }
       
  1083             }
  1071         }
  1084         }
  1072     else
  1085     else
  1073         {
  1086         {
  1074         TRAP(err, item->UpdateRegistrationL(aObserver));
  1087         TRAP(err, item->UpdateRegistrationL(aObserver));
  1075         }
  1088         }
  2351     
  2364     
  2352     PROFILE_DEBUG1("CSIPIMSProfileAgent::UseBackupApn, exit")
  2365     PROFILE_DEBUG1("CSIPIMSProfileAgent::UseBackupApn, exit")
  2353     }
  2366     }
  2354 
  2367 
  2355 // ----------------------------------------------------------------------------
  2368 // ----------------------------------------------------------------------------
       
  2369 // CSIPProfileServerCore::Compare
       
  2370 // ----------------------------------------------------------------------------
       
  2371 //
       
  2372 TBool CSIPProfileServerCore::Compare(const TSIPProfileTypeInfo& first,
       
  2373         const TSIPProfileTypeInfo& second)
       
  2374     {
       
  2375     TInt result = first.iSIPProfileName.Compare(second.iSIPProfileName);
       
  2376     return ( 0 == result && first.iSIPProfileClass == second.iSIPProfileClass);
       
  2377     }
       
  2378 
       
  2379 // ----------------------------------------------------------------------------
  2356 // CSIPProfileServerCore::IsUpdateAllowed
  2380 // CSIPProfileServerCore::IsUpdateAllowed
  2357 // ----------------------------------------------------------------------------
  2381 // ----------------------------------------------------------------------------
  2358 //
  2382 //
  2359 TBool CSIPProfileServerCore::IsUpdateAllowed( CSIPConcreteProfile *aProfile )
  2383 TBool CSIPProfileServerCore::IsUpdateAllowed( CSIPConcreteProfile *aProfile )
  2360     {
  2384     {
  2361     PROFILE_DEBUG1("CSIPIMSProfileAgent::IsUpdateAllowed, enter")
  2385     PROFILE_DEBUG1("CSIPProfileServerCore::IsUpdateAllowed, enter")
  2362     return !(iApnManager->IsFailed(aProfile->IapId()));
  2386     TBool allowed(ETrue);     
  2363     }
  2387     CSIPProfileCacheItem* item = ProfileCacheItem(aProfile->Id());
       
  2388     if(item)
       
  2389         {
       
  2390         CSIPConcreteProfile& profile = item->LatestProfile();
       
  2391         TBool iapIdChange(profile.IapId()!=aProfile->IapId());
       
  2392         if(iapIdChange && 
       
  2393             (iApnManager->IsFailed(aProfile->IapId()) || iApnManager->IsFailed(profile.IapId())))
       
  2394             {
       
  2395             allowed = EFalse;
       
  2396             }
       
  2397         }
       
  2398     return allowed;
       
  2399     }