imstutils/imconversationview/imcvuiengine/src/cimcvenginecchhandler.cpp
branchRCL_3
changeset 27 2b7283837edb
parent 25 fda5a9396e07
--- a/imstutils/imconversationview/imcvuiengine/src/cimcvenginecchhandler.cpp	Mon Jun 21 15:25:20 2010 +0300
+++ b/imstutils/imconversationview/imcvuiengine/src/cimcvenginecchhandler.cpp	Thu Aug 19 09:41:53 2010 +0300
@@ -61,7 +61,8 @@
 			{
 			service->SetObserver( *this );		
 			}
-		}		
+		}
+	iPrevNwError = 0;
 		
     }
 
@@ -280,7 +281,8 @@
 	{
 	
     IM_CV_LOGS(TXT("CVEngineCCHHnadler::DoHandleServiceStatusChangedL ") );   
-
+    IM_CV_LOGS(TXT("CVEngineCCHHnadler::DoHandleServiceStatusChangedL:TCCHSubserviceType=%d"),aType);
+    IM_CV_LOGS(TXT("CVEngineCCHHnadler::DoHandleServiceStatusChangedL:aServiceStatus.Error()=%d"),aServiceStatus.Error());
 	if (aType == ECCHPresenceSub)
 		{
 		/* SIP Adaptation -- sends error in Network Lost. This is added so that once we get it, we will unbindL and delete the context
@@ -305,20 +307,25 @@
 				}
 			case ECCHDisabled:
 				{
-				IM_CV_LOGS(TXT("CVEngineCCHHnadler::DoHandleServiceStatusChangedL DISABLED"));   
-				iEngine.CloseAllOpenChatsL ();
+				IM_CV_LOGS(TXT("CVEngineCCHHnadler::DoHandleServiceStatusChangedL DISABLED"));
+				if(iPrevNwError != KCCHErrorNetworkLost)
+					{
+					iEngine.CloseAllOpenChatsL ();					
+					}
 				iEngine.ReleaseConnectionL();
 				iEngine.DeleteContextL ();
-
 				break;	
 				}
 			case ECCHConnecting:
 				{
+				IM_CV_LOGS(TXT("CVEngineCCHHnadler::DoHandleServiceStatusChangedL ECCHConnecting") );
+				iPrevNwError = aServiceStatus.Error();
 				notifyEvent = MIMCVEngineCCHObserver::EConnecting;
 				break;	
 				}
 			case ECCHEnabled:
 				{
+				IM_CV_LOGS(TXT("CVEngineCCHHnadler::DoHandleServiceStatusChangedL ECCHEnabled") );
 				notifyEvent = MIMCVEngineCCHObserver::ELogin;
 				iEngine.CreateContextL();
 				break;	
@@ -327,13 +334,14 @@
 				{
 				// If NetworkErrorLost error is received by CCH on this state, then do not close all chats
 				// as user would loose all the on-going conversation when the network connection is
-				// restored.				
-				if (aServiceStatus.Error () != KCCHErrorNetworkLost )
-				   {
-					iEngine.CloseAllOpenChatsL();
-					iEngine.ReleaseConnectionL ();
-					iEngine.DeleteContextL ();
-				   }
+				// restored.
+				IM_CV_LOGS(TXT("CVEngineCCHHnadler::DoHandleServiceStatusChangedL ECCHDisconnecting") );				
+//				if (aServiceStatus.Error () != KCCHErrorNetworkLost )
+//				   {
+//					iEngine.CloseAllOpenChatsL();
+//					iEngine.ReleaseConnectionL ();
+//					iEngine.DeleteContextL ();
+//				   }
 				notifyEvent = MIMCVEngineCCHObserver::EDisconnecting;
 				break;	
 				}