realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileCSSession.cpp
branchRCL_3
changeset 16 43c4dec3cb1f
parent 9 1e1cc61f56c3
equal deleted inserted replaced
14:532ef74cdfa0 16:43c4dec3cb1f
   248 void CSIPProfileCSSession::UpdateProfileL(const RMessage2& aMessage)
   248 void CSIPProfileCSSession::UpdateProfileL(const RMessage2& aMessage)
   249     {
   249     {
   250 	HBufC8* profileBuf = iHelper.ReadLC(ESipProfileItcArgProfile,aMessage);
   250 	HBufC8* profileBuf = iHelper.ReadLC(ESipProfileItcArgProfile,aMessage);
   251 	CSIPConcreteProfile* profile = InternalizeProfileLC(*profileBuf);
   251 	CSIPConcreteProfile* profile = InternalizeProfileLC(*profileBuf);
   252 	TBool updateAllowed = iCore.IsUpdateAllowed(profile);
   252 	TBool updateAllowed = iCore.IsUpdateAllowed(profile);
       
   253 	
       
   254 	//Save the dynamic Data before UpdateProfile happens
       
   255 	TBool isProfile = EFalse;
       
   256 	const CSIPConcreteProfile* aProfile = iCore.Profile(profile->Id());
       
   257 	CDesC8ArrayFlat* aRegisteredAORs = NULL;
       
   258 	HBufC8* aNegotiatedSecurityMechanism = NULL;
       
   259 	CSIPConcreteProfile::TStatus status = CSIPConcreteProfile::EUnregistered;
       
   260 	if(aProfile)
       
   261 	    {
       
   262         isProfile = ETrue;
       
   263         status = aProfile->Status();
       
   264         //Copy registeredAors
       
   265         const MDesC8Array& aArray = aProfile->RegisteredAORs();
       
   266         aRegisteredAORs = new (ELeave) CDesC8ArrayFlat(1);
       
   267         CleanupStack::PushL(aRegisteredAORs);
       
   268         for (TInt i = 0; i < aArray.MdcaCount(); i++)
       
   269             {
       
   270             aRegisteredAORs->AppendL(aArray.MdcaPoint(i));
       
   271             }    
       
   272         //Copy NegotiatedSecurityMechanism
       
   273         aNegotiatedSecurityMechanism = aProfile->NegotiatedSecurityMechanism().AllocL();    
       
   274         CleanupStack::PushL(aNegotiatedSecurityMechanism);
       
   275 	    }
       
   276 	
   253 	if(updateAllowed)
   277 	if(updateAllowed)
   254 	    {
   278 	    {
   255         TBool canProceed = iCore.UpdateProfileToStoreL(profile, *this);
   279         TBool canProceed = iCore.UpdateProfileToStoreL(profile, *this);        
   256         CleanupStack::Pop(profile);
       
   257         CleanupStack::PopAndDestroy(profileBuf);
       
   258         if (canProceed)
   280         if (canProceed)
   259             {
   281             {
   260             iCore.UpdateRegistrationL(profile->Id(), *this);
   282             iCore.UpdateRegistrationL(profile->Id(), *this);
   261             }
   283             }
   262 	    }
   284 	    }
   263 	else
   285 	else
   264 	    {
   286 	    {
   265 	    User::Leave(KErrNotSupported);
   287 	    User::Leave(KErrNotSupported);
   266 	    }
   288 	    }
       
   289 
       
   290     //If UpdateProfile has not resulted into deregistration and reregistration
       
   291 	//copy the dynamic data extraced from previous copy of concrete profile to new copy
       
   292     //of concrete profile so that dynamic information is not lost.
       
   293 	CSIPConcreteProfile* aUpdatedProfile = iCore.Profile(profile->Id());    
       
   294     if(aUpdatedProfile && (status == aUpdatedProfile->Status()))
       
   295        {
       
   296        if(0 == aUpdatedProfile->RegisteredAORs().MdcaCount() && aRegisteredAORs)           
       
   297            aUpdatedProfile->SetRegisteredAORsL(*aRegisteredAORs);
       
   298        if(0 == aUpdatedProfile->NegotiatedSecurityMechanism().Length() && aNegotiatedSecurityMechanism)
       
   299            aUpdatedProfile->SetNegotiatedSecurityMechanismL(*aNegotiatedSecurityMechanism);
       
   300        }
       
   301     
       
   302     if(isProfile)
       
   303         {
       
   304         CleanupStack::PopAndDestroy(aNegotiatedSecurityMechanism);
       
   305         CleanupStack::PopAndDestroy(aRegisteredAORs);
       
   306         }
       
   307     
       
   308     CleanupStack::Pop(profile);
       
   309     CleanupStack::PopAndDestroy(profileBuf);
   267     }
   310     }
   268 
   311 
   269 // -----------------------------------------------------------------------------
   312 // -----------------------------------------------------------------------------
   270 // CSIPProfileCSSession::RemoveProfileL
   313 // CSIPProfileCSSession::RemoveProfileL
   271 // -----------------------------------------------------------------------------
   314 // -----------------------------------------------------------------------------