voipplugins/sipconnectionprovider/src/scppresencehandler.cpp
branchRCL_3
changeset 8 7117cbf1600a
parent 0 a4daefaec16c
child 9 bddb6d4447db
--- a/voipplugins/sipconnectionprovider/src/scppresencehandler.cpp	Fri Feb 19 22:44:34 2010 +0200
+++ b/voipplugins/sipconnectionprovider/src/scppresencehandler.cpp	Fri Mar 12 15:42:09 2010 +0200
@@ -207,6 +207,7 @@
         if ( iReqIdArray.Count() )
             {
             iDisableAfterXimpRequestsCompleted = ETrue;
+            StartForcedDisableTimer( CScpPresenceHandler::ForcePresenceServiceDisable );
             }
         else
             {
@@ -244,7 +245,13 @@
         if ( EScpNetworkLost == aEvent )
             {
             SCPLOGSTRING( "CScpPresenceHandler - EScpNetworkLost -> unbind" );
-            TRAP_IGNORE( HandleDeregistrationL( EFalse ) );
+            TRAPD( err, HandleDeregistrationL( EFalse ) );
+            
+            if ( KErrNotReady == err )
+                {
+                SCPLOGSTRING( "CScpPresenceHandler - EScpNetworkLost -> note ready: unbind" );
+                TRAP_IGNORE( ServerUnBindL() );
+                }
             }
         
         if ( EScpRoaming == aEvent )
@@ -298,6 +305,15 @@
                 {
                 CancelDisableTimer();
                 }
+            
+            // If this flag is still true, it could be that presence server
+            // has not given answer -> ximp requests cannot be completed.
+            // But still have to unbind from ximp context
+            if ( iDisableAfterXimpRequestsCompleted )
+                {
+                TRAP_IGNORE( ServerUnBindL() );
+                }
+            
             // When SIP is deregistered, change presence state to no bind
             iPresenceState = ENoBind;
             }
@@ -411,6 +427,7 @@
     
     CancelDisableTimer();
   
+    iReqIdArray.Reset();
     iPresenceState = ENoBind;
 
     // Check if disable was not requested
@@ -913,7 +930,7 @@
     if ( iDisableAfterXimpRequestsCompleted && !iReqIdArray.Count() )
         {
         iDisableAfterXimpRequestsCompleted = EFalse;
-        DisableSubService();
+        DeregisterNow();
         }
     
     SCPLOGSTRING( "CScpPresenceHandler::HandleRequestCompleteEvent OUT" );