evolution-data-server r9751 - in branches/EXCHANGE_MAPI_BRANCH: camel/providers/mapi servers/mapi



Author: jjohnny
Date: Tue Nov 11 22:58:54 2008
New Revision: 9751
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9751&view=rev

Log:
camel/mapi : maintain network states.

Modified:
   branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/ChangeLog
   branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-folder.c
   branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-store.c
   branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-connection.c

Modified: branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-folder.c
==============================================================================
--- branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-folder.c	(original)
+++ branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-folder.c	Tue Nov 11 22:58:54 2008
@@ -528,16 +528,13 @@
 		PR_DISPLAY_BCC
 	};
 
+	if (((CamelOfflineStore *) mapi_store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) 
+		return;
 
 	/* Sync-up the (un)read changes before getting updates,
 	so that the getFolderList will reflect the most recent changes too */
 	mapi_sync (folder, FALSE, ex);
 
-	if (((CamelOfflineStore *) mapi_store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
-		g_warning ("In offline mode. Cannot refresh!!!\n");
-		return;
-	}
-
 	//creating a copy
 	folder_id = camel_mapi_store_folder_id_lookup (mapi_store, folder->full_name);
 	if (!folder_id) {
@@ -1333,10 +1330,8 @@
 
 
 	/* check for offline operation */
-	if (offline->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
-		printf("%s(%d):%s:WARNING : offline op not implemented \n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
+	if (offline->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) 
 		return;
-	}
 
 	folder_id =  camel_mapi_store_folder_id_lookup (mapi_store, source->full_name) ;
 	exchange_mapi_util_mapi_id_from_string (folder_id, &src_fid);

Modified: branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-store.c
==============================================================================
--- branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-store.c	(original)
+++ branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-store.c	Tue Nov 11 22:58:54 2008
@@ -359,11 +359,6 @@
 	service->status = CAMEL_SERVICE_CONNECTED;
 	((CamelOfflineStore *) store)->state = CAMEL_OFFLINE_STORE_NETWORK_AVAIL;
 
-	if (camel_store_summary_count ((CamelStoreSummary *)store->summary) == 0) {
-		/*Settting the refresh stamp to the current time*/
-		//store->refresh_stamp = time (NULL);
-	}
-
 	camel_store_summary_save ((CamelStoreSummary *) store->summary);
 
 	CAMEL_SERVICE_REC_UNLOCK (service, connect_lock);
@@ -374,8 +369,15 @@
 static gboolean 
 mapi_disconnect(CamelService *service, gboolean clean, CamelException *ex)
 {
+	CamelMapiStore *store = CAMEL_MAPI_STORE (service);
+	CamelMapiStorePrivate *priv = store->priv;
+
 	/* Close the mapi subsystem */
 	exchange_mapi_connection_close ();
+
+	((CamelOfflineStore *) store)->state = CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL;
+	service->status = CAMEL_SERVICE_DISCONNECTED;
+
 	return TRUE;
 }
 
@@ -1060,9 +1062,9 @@
 gboolean
 camel_mapi_store_connected (CamelMapiStore *store, CamelException *ex)
 {
-/* 	if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_AVAIL */
-/* 	    && camel_service_connect ((CamelService *)store, ex)) { */
-	if (camel_service_connect ((CamelService *)store, ex))
+	if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_AVAIL
+	    && camel_service_connect ((CamelService *)store, ex)) 
+
 		return TRUE;
 
 	return FALSE;
@@ -1187,9 +1189,11 @@
 	 * is used as is here.
 	 */
 
-	if (!check_for_connection((CamelService *)store, ex)) {
-		((CamelService *)store)->status = CAMEL_SERVICE_CONNECTING;
-		mapi_connect ((CamelService *)store, ex);
+	if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_AVAIL) {
+		if (((CamelService *)store)->status == CAMEL_SERVICE_DISCONNECTED){
+			((CamelService *)store)->status = CAMEL_SERVICE_CONNECTING;
+			mapi_connect ((CamelService *)store, ex);
+		}
 	}
 
 	if (check_for_connection((CamelService *)store, ex)) {

Modified: branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-connection.c
==============================================================================
--- branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-connection.c	(original)
+++ branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-connection.c	Tue Nov 11 22:58:54 2008
@@ -143,6 +143,7 @@
 {
 	global_mapi_session = NULL;
 	MAPIUninitialize ();	
+	/* TODO :  Return status. get last error ? */
 }
 
 static gboolean 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]