webservices/wsoviplugin/src/wsoviserviceupdatehandler.cpp
changeset 23 a1df79fa35b4
parent 1 272b002df977
--- a/webservices/wsoviplugin/src/wsoviserviceupdatehandler.cpp	Fri Apr 16 16:07:50 2010 +0300
+++ b/webservices/wsoviplugin/src/wsoviserviceupdatehandler.cpp	Fri Jun 11 14:42:58 2010 +0300
@@ -32,6 +32,8 @@
 #include <httpstd.h>
 #include <SenHttpTransportProperties.h>
 #include "senlayeredhttptransportproperties.h"
+#include <SenDateUtils.h>
+
 using namespace OAuth;
 
 
@@ -139,7 +141,17 @@
 						{
 						pCtx.Add(WSOviContextKeys::KServiceSession, *(MSenRemoteServiceSession*)remoteServiceSession);
 						}
-					pCtx.Update(WSOviContextKeys::KReAuthNeeded, ETrue);
+					if( ! errFragment->Text().Compare(WSOviResponse::KEmailUsed()) ||
+					  (errFragment->Text().Compare(WSOviResponse::KMobileUsed1)!= KErrNotFound &&
+					   errFragment->Text().Compare(WSOviResponse::KMobileUsed2) != KErrNotFound )
+					  )
+					    {
+					    pCtx.Update(WSOviContextKeys::KRetryNeeded, EFalse);
+					    }
+					else
+					    {
+					    pCtx.Update(WSOviContextKeys::KReAuthNeeded, ETrue);
+					    }
 					oviServiceSession->ClearCredentialL();
 					oviServiceSession->SetStatusL();//in order to compute state
 				}
@@ -206,6 +218,20 @@
                         }
                     else
                         {
+					    TPtrC8 validUntil = responseFragment->ValidUntil();
+					    if (validUntil.Length())
+					        {
+					        TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,validUntil);
+					        User::LeaveIfError(pCtx.Update(WSOviContextKeys::KTokenValidUntilTime,validUntil));
+					        }
+						else
+							{
+							TTime tmpValidUntil = Time::MaxTTime();
+							TBuf8<SenDateUtils::KXmlDateTimeMaxLength> pValidUntil;
+							SenDateUtils::ToXmlDateTimeUtf8L(pValidUntil, tmpValidUntil);
+					        User::LeaveIfError(pCtx.Update(WSOviContextKeys::KTokenValidUntilTime,pValidUntil));
+							}
+                       
                         pCtx.SetTokenKeysL(token);
                         }
                     }