voipplugins/sipconnectionprovider/src/scppresencehandler.cpp
branchRCL_3
changeset 10 7117cbf1600a
parent 0 a4daefaec16c
child 11 bddb6d4447db
equal deleted inserted replaced
6:fc8c25e5a2e8 10:7117cbf1600a
   205         // Wait for XIMP request to be completed and handle 
   205         // Wait for XIMP request to be completed and handle 
   206         // de-registration after that or after force disable timer expires
   206         // de-registration after that or after force disable timer expires
   207         if ( iReqIdArray.Count() )
   207         if ( iReqIdArray.Count() )
   208             {
   208             {
   209             iDisableAfterXimpRequestsCompleted = ETrue;
   209             iDisableAfterXimpRequestsCompleted = ETrue;
       
   210             StartForcedDisableTimer( CScpPresenceHandler::ForcePresenceServiceDisable );
   210             }
   211             }
   211         else
   212         else
   212             {
   213             {
   213             DeregisterNow();
   214             DeregisterNow();
   214             }
   215             }
   242         {
   243         {
   243         //if network lost, unbind context
   244         //if network lost, unbind context
   244         if ( EScpNetworkLost == aEvent )
   245         if ( EScpNetworkLost == aEvent )
   245             {
   246             {
   246             SCPLOGSTRING( "CScpPresenceHandler - EScpNetworkLost -> unbind" );
   247             SCPLOGSTRING( "CScpPresenceHandler - EScpNetworkLost -> unbind" );
   247             TRAP_IGNORE( HandleDeregistrationL( EFalse ) );
   248             TRAPD( err, HandleDeregistrationL( EFalse ) );
       
   249             
       
   250             if ( KErrNotReady == err )
       
   251                 {
       
   252                 SCPLOGSTRING( "CScpPresenceHandler - EScpNetworkLost -> note ready: unbind" );
       
   253                 TRAP_IGNORE( ServerUnBindL() );
       
   254                 }
   248             }
   255             }
   249         
   256         
   250         if ( EScpRoaming == aEvent )
   257         if ( EScpRoaming == aEvent )
   251             {
   258             {
   252             SCPLOGSTRING( "CScpPresenceHandler - EScpRoaming -> unbind" );
   259             SCPLOGSTRING( "CScpPresenceHandler - EScpRoaming -> unbind" );
   296             {
   303             {
   297             if ( EScpRegistered != aEvent && ECCHDisconnecting != iSubService.State() )
   304             if ( EScpRegistered != aEvent && ECCHDisconnecting != iSubService.State() )
   298                 {
   305                 {
   299                 CancelDisableTimer();
   306                 CancelDisableTimer();
   300                 }
   307                 }
       
   308             
       
   309             // If this flag is still true, it could be that presence server
       
   310             // has not given answer -> ximp requests cannot be completed.
       
   311             // But still have to unbind from ximp context
       
   312             if ( iDisableAfterXimpRequestsCompleted )
       
   313                 {
       
   314                 TRAP_IGNORE( ServerUnBindL() );
       
   315                 }
       
   316             
   301             // When SIP is deregistered, change presence state to no bind
   317             // When SIP is deregistered, change presence state to no bind
   302             iPresenceState = ENoBind;
   318             iPresenceState = ENoBind;
   303             }
   319             }
   304         iSubService.HandleConnectionEvent( aEvent );
   320         iSubService.HandleConnectionEvent( aEvent );
   305         }
   321         }
   409     SCPLOGSTRING2( "CScpPresenceHandler[0x%x]::DeregisterNow",
   425     SCPLOGSTRING2( "CScpPresenceHandler[0x%x]::DeregisterNow",
   410                    this );
   426                    this );
   411     
   427     
   412     CancelDisableTimer();
   428     CancelDisableTimer();
   413   
   429   
       
   430     iReqIdArray.Reset();
   414     iPresenceState = ENoBind;
   431     iPresenceState = ENoBind;
   415 
   432 
   416     // Check if disable was not requested
   433     // Check if disable was not requested
   417     if ( iSubService.EnableRequestedState() == CScpSubService::EScpEnabled )
   434     if ( iSubService.EnableRequestedState() == CScpSubService::EScpEnabled )
   418         {
   435         {
   911         }
   928         }
   912     
   929     
   913     if ( iDisableAfterXimpRequestsCompleted && !iReqIdArray.Count() )
   930     if ( iDisableAfterXimpRequestsCompleted && !iReqIdArray.Count() )
   914         {
   931         {
   915         iDisableAfterXimpRequestsCompleted = EFalse;
   932         iDisableAfterXimpRequestsCompleted = EFalse;
   916         DisableSubService();
   933         DeregisterNow();
   917         }
   934         }
   918     
   935     
   919     SCPLOGSTRING( "CScpPresenceHandler::HandleRequestCompleteEvent OUT" ); 
   936     SCPLOGSTRING( "CScpPresenceHandler::HandleRequestCompleteEvent OUT" ); 
   920     }
   937     }
   921 
   938