webservices/wsoviplugin/src/wsoviserviceupdatehandler.cpp
changeset 23 a1df79fa35b4
parent 1 272b002df977
equal deleted inserted replaced
16:abb636afedf7 23:a1df79fa35b4
    30 #include "wsovicons.h"
    30 #include "wsovicons.h"
    31 #include "wsovierrorresponse.h"
    31 #include "wsovierrorresponse.h"
    32 #include <httpstd.h>
    32 #include <httpstd.h>
    33 #include <SenHttpTransportProperties.h>
    33 #include <SenHttpTransportProperties.h>
    34 #include "senlayeredhttptransportproperties.h"
    34 #include "senlayeredhttptransportproperties.h"
       
    35 #include <SenDateUtils.h>
       
    36 
    35 using namespace OAuth;
    37 using namespace OAuth;
    36 
    38 
    37 
    39 
    38 
    40 
    39 class CWSOviHandlerContext;
    41 class CWSOviHandlerContext;
   137                     TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,(_L("----- if WSOviResponse::KErrorCodeUnauthorized()")));
   139                     TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,(_L("----- if WSOviResponse::KErrorCodeUnauthorized()")));
   138 					if (!pCtx.GetSenRemoteServiceSessionL(WSOviContextKeys::KServiceSession))
   140 					if (!pCtx.GetSenRemoteServiceSessionL(WSOviContextKeys::KServiceSession))
   139 						{
   141 						{
   140 						pCtx.Add(WSOviContextKeys::KServiceSession, *(MSenRemoteServiceSession*)remoteServiceSession);
   142 						pCtx.Add(WSOviContextKeys::KServiceSession, *(MSenRemoteServiceSession*)remoteServiceSession);
   141 						}
   143 						}
   142 					pCtx.Update(WSOviContextKeys::KReAuthNeeded, ETrue);
   144 					if( ! errFragment->Text().Compare(WSOviResponse::KEmailUsed()) ||
       
   145 					  (errFragment->Text().Compare(WSOviResponse::KMobileUsed1)!= KErrNotFound &&
       
   146 					   errFragment->Text().Compare(WSOviResponse::KMobileUsed2) != KErrNotFound )
       
   147 					  )
       
   148 					    {
       
   149 					    pCtx.Update(WSOviContextKeys::KRetryNeeded, EFalse);
       
   150 					    }
       
   151 					else
       
   152 					    {
       
   153 					    pCtx.Update(WSOviContextKeys::KReAuthNeeded, ETrue);
       
   154 					    }
   143 					oviServiceSession->ClearCredentialL();
   155 					oviServiceSession->ClearCredentialL();
   144 					oviServiceSession->SetStatusL();//in order to compute state
   156 					oviServiceSession->SetStatusL();//in order to compute state
   145 				}
   157 				}
   146 			else
   158 			else
   147 			    {
   159 			    {
   204                         {
   216                         {
   205                         pCtx.Remove(WSOviContextKeys::KTokenCreationTime);
   217                         pCtx.Remove(WSOviContextKeys::KTokenCreationTime);
   206                         }
   218                         }
   207                     else
   219                     else
   208                         {
   220                         {
       
   221 					    TPtrC8 validUntil = responseFragment->ValidUntil();
       
   222 					    if (validUntil.Length())
       
   223 					        {
       
   224 					        TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,validUntil);
       
   225 					        User::LeaveIfError(pCtx.Update(WSOviContextKeys::KTokenValidUntilTime,validUntil));
       
   226 					        }
       
   227 						else
       
   228 							{
       
   229 							TTime tmpValidUntil = Time::MaxTTime();
       
   230 							TBuf8<SenDateUtils::KXmlDateTimeMaxLength> pValidUntil;
       
   231 							SenDateUtils::ToXmlDateTimeUtf8L(pValidUntil, tmpValidUntil);
       
   232 					        User::LeaveIfError(pCtx.Update(WSOviContextKeys::KTokenValidUntilTime,pValidUntil));
       
   233 							}
       
   234                        
   209                         pCtx.SetTokenKeysL(token);
   235                         pCtx.SetTokenKeysL(token);
   210                         }
   236                         }
   211                     }
   237                     }
   212                 if (!ttlInfinitive)
   238                 if (!ttlInfinitive)
   213                     {
   239                     {