voipplugins/sipconnectionprovider/src/scppresencehandler.cpp
branchRCL_3
changeset 10 ed1e38b404e5
parent 9 bddb6d4447db
child 20 65a3ef1d5bd0
equal deleted inserted replaced
9:bddb6d4447db 10:ed1e38b404e5
    37 #include <ownpresenceevent.h>
    37 #include <ownpresenceevent.h>
    38 #include <ximpclient.h>
    38 #include <ximpclient.h>
    39 #include <ximpcontext.h>
    39 #include <ximpcontext.h>
    40 #include <ximpstatus.h>
    40 #include <ximpstatus.h>
    41 #include <pressettingsapi.h> //presence settings
    41 #include <pressettingsapi.h> //presence settings
    42 #include <xdmsettingsapi.h>
    42 #include <XdmSettingsApi.h>
    43 #include <cvimpstsettingsstore.h>
    43 #include <cvimpstsettingsstore.h>
    44 
    44 
    45 #include "scppresencehandler.h"
    45 #include "scppresencehandler.h"
    46 #include "scpsubservice.h"
    46 #include "scpsubservice.h"
    47 #include "scpservicestorage.h"
    47 #include "scpservicestorage.h"
    76 // -----------------------------------------------------------------------------
    76 // -----------------------------------------------------------------------------
    77 //
    77 //
    78 CScpPresenceHandler::CScpPresenceHandler( CScpSubService& aSubService ) :
    78 CScpPresenceHandler::CScpPresenceHandler( CScpSubService& aSubService ) :
    79     CScpServiceHandlerBase( aSubService ),
    79     CScpServiceHandlerBase( aSubService ),
    80     iPresenceState( ENoBind ),
    80     iPresenceState( ENoBind ),
    81     iDisableAfterXimpRequestsCompleted( EFalse )
    81     iDisableAfterXimpRequestsCompleted( EFalse ),
       
    82     iNetworkLostRoamingOngoing( EFalse )
    82     {
    83     {
    83     SCPLOGSTRING2( "CScpPresenceHandler[0x%x]::CScpPresenceHandler", this );
    84     SCPLOGSTRING2( "CScpPresenceHandler[0x%x]::CScpPresenceHandler", this );
    84     }
    85     }
    85 
    86 
    86 // -----------------------------------------------------------------------------
    87 // -----------------------------------------------------------------------------
   236                                                     TScpConnectionEvent aEvent )
   237                                                     TScpConnectionEvent aEvent )
   237     {
   238     {
   238     SCPLOGSTRING4( "CScpPresenceHandler[0x%x]::HandleSipConnectionEvent id: %d event: %d",
   239     SCPLOGSTRING4( "CScpPresenceHandler[0x%x]::HandleSipConnectionEvent id: %d event: %d",
   239                    this, aProfileId, aEvent );
   240                    this, aProfileId, aEvent );
   240     
   241     
       
   242     iNetworkLostRoamingOngoing = EFalse;
       
   243     
   241     if ( iSubService.SipProfileId() == aProfileId &&
   244     if ( iSubService.SipProfileId() == aProfileId &&
   242         iSubService.EnableRequestedState() != CScpSubService::EScpNoRequest )
   245         iSubService.EnableRequestedState() != CScpSubService::EScpNoRequest )
   243         {
   246         {
   244         //if network lost, unbind context
   247         //if network lost, unbind context
   245         if ( EScpNetworkLost == aEvent )
   248         if ( EScpNetworkLost == aEvent )
   247             SCPLOGSTRING( "CScpPresenceHandler - EScpNetworkLost -> unbind" );
   250             SCPLOGSTRING( "CScpPresenceHandler - EScpNetworkLost -> unbind" );
   248             TRAPD( err, HandleDeregistrationL( EFalse ) );
   251             TRAPD( err, HandleDeregistrationL( EFalse ) );
   249             
   252             
   250             if ( KErrNotReady == err )
   253             if ( KErrNotReady == err )
   251                 {
   254                 {
   252                 SCPLOGSTRING( "CScpPresenceHandler - EScpNetworkLost -> note ready: unbind" );
   255                 SCPLOGSTRING( "CScpPresenceHandler - EScpNetworkLost -> not ready: unbind" );
   253                 TRAP_IGNORE( ServerUnBindL() );
   256                 TRAP_IGNORE( ServerUnBindL() );
       
   257                 }
       
   258             
       
   259             TUint32 snapId;
       
   260             CScpProfileHandler& profileHandler = iSubService.ProfileHandler();
       
   261             CScpSipConnection* sipConnection = profileHandler.GetSipConnection( iSubService.SipProfileId() );
       
   262             
       
   263             if ( sipConnection )
       
   264                 {
       
   265                 TInt error = sipConnection->GetSnap( snapId );
       
   266                 
       
   267                 if ( !error && sipConnection->IsSnapConnectionAvailable( snapId ) )
       
   268                     {
       
   269                     iNetworkLostRoamingOngoing = ETrue;
       
   270                     }
   254                 }
   271                 }
   255             }
   272             }
   256         
   273         
   257         if ( EScpRoaming == aEvent )
   274         if ( EScpRoaming == aEvent )
   258             {
   275             {
   916     
   933     
   917     // Unbind request complete
   934     // Unbind request complete
   918     else if ( reqType == EUnBindReq && EUnBinding == iPresenceState )
   935     else if ( reqType == EUnBindReq && EUnBinding == iPresenceState )
   919         {
   936         {
   920         SCPLOGSTRING( "CScpPresenceHandler::HandleRequestCompleteEvent status offline" );
   937         SCPLOGSTRING( "CScpPresenceHandler::HandleRequestCompleteEvent status offline" );
   921         
       
   922         // Do not send info to our client if roaming is ongoing 
   938         // Do not send info to our client if roaming is ongoing 
   923         if ( !iSubService.IsRoaming() )
   939         if ( !iNetworkLostRoamingOngoing )
   924             {
   940             {
   925             DeregisterNow();
   941             if ( !iSubService.IsRoaming() )
   926             }
   942                 {
   927 		// Inform SIP to start ALR migration
   943                 DeregisterNow();
   928         else
   944                 }
   929             {
   945             else
   930             iSubService.ProfileHandler().StartAlrMigration( iSubService.SipProfileId() );
   946                 {
   931             }
   947                 // Inform SIP to start ALR migration
   932         
   948                 iSubService.ProfileHandler().StartAlrMigration(
       
   949                     iSubService.SipProfileId() );
       
   950                 }
       
   951             }
   933         SCPLOGSTRING( "CScpPresenceHandler::HandleRequestCompleteEvent status offline end" );
   952         SCPLOGSTRING( "CScpPresenceHandler::HandleRequestCompleteEvent status offline end" );
   934         }
   953         }
   935     
   954     
   936     if ( iRebind )
   955     if ( iRebind )
   937         {
   956         {