voipplugins/sipconnectionprovider/src/scppresencehandler.cpp
branchRCL_3
changeset 15 ed1e38b404e5
parent 11 bddb6d4447db
child 26 65a3ef1d5bd0
--- a/voipplugins/sipconnectionprovider/src/scppresencehandler.cpp	Mon Mar 15 12:39:55 2010 +0200
+++ b/voipplugins/sipconnectionprovider/src/scppresencehandler.cpp	Wed Mar 31 21:20:05 2010 +0300
@@ -39,7 +39,7 @@
 #include <ximpcontext.h>
 #include <ximpstatus.h>
 #include <pressettingsapi.h> //presence settings
-#include <xdmsettingsapi.h>
+#include <XdmSettingsApi.h>
 #include <cvimpstsettingsstore.h>
 
 #include "scppresencehandler.h"
@@ -78,7 +78,8 @@
 CScpPresenceHandler::CScpPresenceHandler( CScpSubService& aSubService ) :
     CScpServiceHandlerBase( aSubService ),
     iPresenceState( ENoBind ),
-    iDisableAfterXimpRequestsCompleted( EFalse )
+    iDisableAfterXimpRequestsCompleted( EFalse ),
+    iNetworkLostRoamingOngoing( EFalse )
     {
     SCPLOGSTRING2( "CScpPresenceHandler[0x%x]::CScpPresenceHandler", this );
     }
@@ -238,6 +239,8 @@
     SCPLOGSTRING4( "CScpPresenceHandler[0x%x]::HandleSipConnectionEvent id: %d event: %d",
                    this, aProfileId, aEvent );
     
+    iNetworkLostRoamingOngoing = EFalse;
+    
     if ( iSubService.SipProfileId() == aProfileId &&
         iSubService.EnableRequestedState() != CScpSubService::EScpNoRequest )
         {
@@ -249,9 +252,23 @@
             
             if ( KErrNotReady == err )
                 {
-                SCPLOGSTRING( "CScpPresenceHandler - EScpNetworkLost -> note ready: unbind" );
+                SCPLOGSTRING( "CScpPresenceHandler - EScpNetworkLost -> not ready: unbind" );
                 TRAP_IGNORE( ServerUnBindL() );
                 }
+            
+            TUint32 snapId;
+            CScpProfileHandler& profileHandler = iSubService.ProfileHandler();
+            CScpSipConnection* sipConnection = profileHandler.GetSipConnection( iSubService.SipProfileId() );
+            
+            if ( sipConnection )
+                {
+                TInt error = sipConnection->GetSnap( snapId );
+                
+                if ( !error && sipConnection->IsSnapConnectionAvailable( snapId ) )
+                    {
+                    iNetworkLostRoamingOngoing = ETrue;
+                    }
+                }
             }
         
         if ( EScpRoaming == aEvent )
@@ -918,18 +935,20 @@
     else if ( reqType == EUnBindReq && EUnBinding == iPresenceState )
         {
         SCPLOGSTRING( "CScpPresenceHandler::HandleRequestCompleteEvent status offline" );
-        
         // Do not send info to our client if roaming is ongoing 
-        if ( !iSubService.IsRoaming() )
+        if ( !iNetworkLostRoamingOngoing )
             {
-            DeregisterNow();
+            if ( !iSubService.IsRoaming() )
+                {
+                DeregisterNow();
+                }
+            else
+                {
+                // Inform SIP to start ALR migration
+                iSubService.ProfileHandler().StartAlrMigration(
+                    iSubService.SipProfileId() );
+                }
             }
-		// Inform SIP to start ALR migration
-        else
-            {
-            iSubService.ProfileHandler().StartAlrMigration( iSubService.SipProfileId() );
-            }
-        
         SCPLOGSTRING( "CScpPresenceHandler::HandleRequestCompleteEvent status offline end" );
         }