evolution-exchange r1627 - in trunk: . camel mail storage



Author: abharath
Date: Fri Apr 25 08:09:48 2008
New Revision: 1627
URL: http://svn.gnome.org/viewvc/evolution-exchange?rev=1627&view=rev

Log:
Fixes #358706 (bnc) *If Evolution is switched from Offline to Online, the stub is disconnected and no stub operations would work. This fixes it

Modified:
   trunk/ChangeLog
   trunk/camel/camel-exchange-store.c
   trunk/mail/mail-stub-listener.h
   trunk/storage/exchange-component.c

Modified: trunk/camel/camel-exchange-store.c
==============================================================================
--- trunk/camel/camel-exchange-store.c	(original)
+++ trunk/camel/camel-exchange-store.c	Fri Apr 25 08:09:48 2008
@@ -376,6 +376,14 @@
 	}
 }
 
+static void
+update_camel_stub (gpointer folder_name, gpointer folder, gpointer user_data)
+{
+	CamelExchangeFolder *exch_folder = CAMEL_EXCHANGE_FOLDER (folder);
+	if (exch_folder)
+		exch_folder->stub = (CamelStub *)user_data;
+}
+
 static gboolean
 exchange_connect (CamelService *service, CamelException *ex)
 {
@@ -421,6 +429,8 @@
 	if (online_mode) {
 		camel_exchange_get_password (service, ex);
 		if (camel_exception_is_set (ex)) {
+			camel_object_unref (exch->stub);
+			exch->stub = NULL;
 			g_mutex_unlock (exch->connect_lock);
 			return FALSE;
 		}
@@ -447,12 +457,16 @@
 		camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
 				     _("Could not authenticate to server. "
 				       "(Password incorrect?)\n\n"));
+		camel_object_unref (exch->stub);
+		exch->stub = NULL;
 		g_mutex_unlock (exch->connect_lock);
 		return FALSE;
 	} else {
 		exch->stub_connected = TRUE;
 	}
 
+	g_hash_table_foreach (exch->folders, update_camel_stub, exch->stub);
+	
 	g_mutex_unlock (exch->connect_lock);
 
 	return TRUE;
@@ -461,6 +475,13 @@
 static gboolean
 exchange_disconnect (CamelService *service, gboolean clean, CamelException *ex)
 {
+
+	CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (service);
+	
+	if (exch->stub) {
+		exch->stub = NULL;
+	}
+	
 	return TRUE;
 }
 

Modified: trunk/mail/mail-stub-listener.h
==============================================================================
--- trunk/mail/mail-stub-listener.h	(original)
+++ trunk/mail/mail-stub-listener.h	Fri Apr 25 08:09:48 2008
@@ -23,6 +23,7 @@
 struct _MailStubListener {
 	GObject parent;
 
+	gpointer *stub;
 	char *socket_path;
 	GIOChannel *channel;
 

Modified: trunk/storage/exchange-component.c
==============================================================================
--- trunk/storage/exchange-component.c	(original)
+++ trunk/storage/exchange-component.c	Fri Apr 25 08:09:48 2008
@@ -274,7 +274,7 @@
 		if (ev->_major == CORBA_NO_EXCEPTION) {
 			exchange_component_update_accounts (component, status);
 			g_signal_emit (component, linestatus_signal_id, 0,
-				       status ? ONLINE_MODE : OFFLINE_MODE);
+				       priv->linestatus ? ONLINE_MODE : OFFLINE_MODE);
 			return;
 		} else {
 			CORBA_exception_free (ev);
@@ -342,7 +342,8 @@
 new_connection (MailStubListener *listener, int cmd_fd, int status_fd,
 		ExchangeComponentAccount *baccount)
 {
-	MailStub *mse;
+	MailStub *stub;
+	MailStubExchange *mse, *mse_prev;
 	ExchangeAccount *account = baccount->account;
 	int mode;
 
@@ -354,7 +355,17 @@
 		goto end;
 	}
 
-	mse = mail_stub_exchange_new (account, cmd_fd, status_fd);
+	stub = mail_stub_exchange_new (account, cmd_fd, status_fd);
+	mse = (MailStubExchange *) stub; 
+	mse_prev = (MailStubExchange *) listener->stub;
+	if (mse_prev) {
+		g_hash_table_destroy (mse->folders_by_name);
+		mse->folders_by_name = mse_prev->folders_by_name;
+		mse_prev->folders_by_name = NULL;
+	}
+
+	g_object_unref (listener->stub);
+	listener->stub = mse;
 	/* FIXME : We need to close these sockets */
 /*
 	if (exchange_account_connect (account, NULL, &result))



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