evolution-exchange r1628 - in branches/gnome-2-22: . camel mail storage



Author: abharath
Date: Fri May  2 04:38:03 2008
New Revision: 1628
URL: http://svn.gnome.org/viewvc/evolution-exchange?rev=1628&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:
   branches/gnome-2-22/ChangeLog
   branches/gnome-2-22/camel/camel-exchange-store.c
   branches/gnome-2-22/mail/mail-stub-listener.h
   branches/gnome-2-22/storage/exchange-component.c

Modified: branches/gnome-2-22/camel/camel-exchange-store.c
==============================================================================
--- branches/gnome-2-22/camel/camel-exchange-store.c	(original)
+++ branches/gnome-2-22/camel/camel-exchange-store.c	Fri May  2 04:38:03 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: branches/gnome-2-22/mail/mail-stub-listener.h
==============================================================================
--- branches/gnome-2-22/mail/mail-stub-listener.h	(original)
+++ branches/gnome-2-22/mail/mail-stub-listener.h	Fri May  2 04:38:03 2008
@@ -23,6 +23,7 @@
 struct _MailStubListener {
 	GObject parent;
 
+	gpointer *stub;
 	char *socket_path;
 	GIOChannel *channel;
 

Modified: branches/gnome-2-22/storage/exchange-component.c
==============================================================================
--- branches/gnome-2-22/storage/exchange-component.c	(original)
+++ branches/gnome-2-22/storage/exchange-component.c	Fri May  2 04:38:03 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]