Blob Blame History Raw
diff -up evolution-data-server-3.8.5/camel/camel.h.kill-imapx-conn-manager evolution-data-server-3.8.5/camel/camel.h
--- evolution-data-server-3.8.5/camel/camel.h.kill-imapx-conn-manager	2013-07-23 07:57:56.000000000 -0400
+++ evolution-data-server-3.8.5/camel/camel.h	2013-09-12 15:51:33.362412243 -0400
@@ -144,7 +144,6 @@
 #include <camel/camel-vtrash-folder.h>
 #include <camel/camel-imapx-command.h>
 #include <camel/camel-imapx-job.h>
-#include <camel/camel-imapx-conn-manager.h>
 #include <camel/camel-imapx-folder.h>
 #include <camel/camel-imapx-search.h>
 #include <camel/camel-imapx-server.h>
diff -up evolution-data-server-3.8.5/camel/camel-imapx-conn-manager.c.kill-imapx-conn-manager evolution-data-server-3.8.5/camel/camel-imapx-conn-manager.c
diff -up evolution-data-server-3.8.5/camel/camel-imapx-conn-manager.h.kill-imapx-conn-manager evolution-data-server-3.8.5/camel/camel-imapx-conn-manager.h
diff -up evolution-data-server-3.8.5/camel/camel-imapx-folder.c.kill-imapx-conn-manager evolution-data-server-3.8.5/camel/camel-imapx-folder.c
--- evolution-data-server-3.8.5/camel/camel-imapx-folder.c.kill-imapx-conn-manager	2013-07-23 08:01:51.000000000 -0400
+++ evolution-data-server-3.8.5/camel/camel-imapx-folder.c	2013-09-12 15:51:33.323412254 -0400
@@ -178,7 +178,7 @@ static void
 imapx_folder_dispose (GObject *object)
 {
 	CamelIMAPXFolder *folder = CAMEL_IMAPX_FOLDER (object);
-	CamelStore *parent_store;
+	CamelStore *store;
 
 	if (folder->cache != NULL) {
 		g_object_unref (folder->cache);
@@ -190,10 +190,10 @@ imapx_folder_dispose (GObject *object)
 		folder->search = NULL;
 	}
 
-	parent_store = camel_folder_get_parent_store (CAMEL_FOLDER (folder));
-	if (parent_store) {
+	store = camel_folder_get_parent_store (CAMEL_FOLDER (folder));
+	if (store != NULL) {
 		camel_store_summary_disconnect_folder_summary (
-			(CamelStoreSummary *) ((CamelIMAPXStore *) parent_store)->summary,
+			(CamelStoreSummary *) ((CamelIMAPXStore *) store)->summary,
 			CAMEL_FOLDER (folder)->summary);
 	}
 
@@ -283,15 +283,17 @@ static void
 imapx_search_free (CamelFolder *folder,
                    GPtrArray *uids)
 {
-	CamelIMAPXFolder *ifolder = CAMEL_IMAPX_FOLDER (folder);
+	CamelIMAPXFolder *imapx_folder;
 
-	g_return_if_fail (ifolder->search);
+	imapx_folder = CAMEL_IMAPX_FOLDER (folder);
 
-	g_mutex_lock (&ifolder->search_lock);
+	g_return_if_fail (imapx_folder->search);
 
-	camel_folder_search_free_result (ifolder->search, uids);
+	g_mutex_lock (&imapx_folder->search_lock);
 
-	g_mutex_unlock (&ifolder->search_lock);
+	camel_folder_search_free_result (imapx_folder->search, uids);
+
+	g_mutex_unlock (&imapx_folder->search_lock);
 }
 
 static GPtrArray *
@@ -301,48 +303,37 @@ imapx_search_by_uids (CamelFolder *folde
                       GCancellable *cancellable,
                       GError **error)
 {
-	CamelIMAPXFolder *ifolder;
-	CamelIMAPXSearch *isearch;
-	CamelIMAPXServer *server = NULL;
-	CamelStore *parent_store;
+	CamelIMAPXStore *imapx_store;
+	CamelIMAPXFolder *imapx_folder;
+	CamelIMAPXSearch *imapx_search;
+	CamelIMAPXServer *imapx_server;
+	CamelStore *store;
 	GPtrArray *matches;
-	const gchar *folder_name;
-	gboolean online;
 
 	if (uids->len == 0)
 		return g_ptr_array_new ();
 
-	ifolder = CAMEL_IMAPX_FOLDER (folder);
-	folder_name = camel_folder_get_full_name (folder);
-	parent_store = camel_folder_get_parent_store (folder);
-
-	online = camel_offline_store_get_online (
-		CAMEL_OFFLINE_STORE (parent_store));
+	imapx_folder = CAMEL_IMAPX_FOLDER (folder);
+	store = camel_folder_get_parent_store (folder);
 
-	if (online) {
-		/* do not panic when the server cannot be reached for whatever reason,
-		 * show offline data at least */
-		server = camel_imapx_store_get_server (
-			CAMEL_IMAPX_STORE (parent_store),
-			folder_name, cancellable, NULL);
-	}
+	imapx_store = CAMEL_IMAPX_STORE (store);
+	imapx_server = camel_imapx_store_ref_server (imapx_store, NULL);
 
-	g_mutex_lock (&ifolder->search_lock);
+	g_mutex_lock (&imapx_folder->search_lock);
 
-	isearch = CAMEL_IMAPX_SEARCH (ifolder->search);
-	camel_imapx_search_set_server (isearch, server);
+	imapx_search = CAMEL_IMAPX_SEARCH (imapx_folder->search);
+	camel_imapx_search_set_server (imapx_search, imapx_server);
 
-	camel_folder_search_set_folder (ifolder->search, folder);
+	camel_folder_search_set_folder (imapx_folder->search, folder);
 
 	matches = camel_folder_search_search (
-		ifolder->search, expression, uids, cancellable, error);
+		imapx_folder->search, expression, uids, cancellable, error);
 
-	camel_imapx_search_set_server (isearch, NULL);
+	camel_imapx_search_set_server (imapx_search, NULL);
 
-	g_mutex_unlock (&ifolder->search_lock);
+	g_mutex_unlock (&imapx_folder->search_lock);
 
-	if (server != NULL)
-		g_object_unref (server);
+	g_clear_object (&imapx_server);
 
 	return matches;
 }
@@ -353,45 +344,34 @@ imapx_count_by_expression (CamelFolder *
                            GCancellable *cancellable,
                            GError **error)
 {
-	CamelIMAPXFolder *ifolder;
-	CamelIMAPXSearch *isearch;
-	CamelIMAPXServer *server = NULL;
-	CamelStore *parent_store;
-	const gchar *folder_name;
-	gboolean online;
+	CamelIMAPXStore *imapx_store;
+	CamelIMAPXFolder *imapx_folder;
+	CamelIMAPXSearch *imapx_search;
+	CamelIMAPXServer *imapx_server;
+	CamelStore *store;
 	guint32 matches;
 
-	ifolder = CAMEL_IMAPX_FOLDER (folder);
-	folder_name = camel_folder_get_full_name (folder);
-	parent_store = camel_folder_get_parent_store (folder);
-
-	online = camel_offline_store_get_online (
-		CAMEL_OFFLINE_STORE (parent_store));
+	imapx_folder = CAMEL_IMAPX_FOLDER (folder);
+	store = camel_folder_get_parent_store (folder);
 
-	if (online) {
-		/* do not panic when the server cannot be reached for whatever reason,
-		 * show offline data at least */
-		server = camel_imapx_store_get_server (
-			CAMEL_IMAPX_STORE (parent_store),
-			folder_name, cancellable, NULL);
-	}
+	imapx_store = CAMEL_IMAPX_STORE (store);
+	imapx_server = camel_imapx_store_ref_server (imapx_store, NULL);
 
-	g_mutex_lock (&ifolder->search_lock);
+	g_mutex_lock (&imapx_folder->search_lock);
 
-	isearch = CAMEL_IMAPX_SEARCH (ifolder->search);
-	camel_imapx_search_set_server (isearch, server);
+	imapx_search = CAMEL_IMAPX_SEARCH (imapx_folder->search);
+	camel_imapx_search_set_server (imapx_search, imapx_server);
 
-	camel_folder_search_set_folder (ifolder->search, folder);
+	camel_folder_search_set_folder (imapx_folder->search, folder);
 
 	matches = camel_folder_search_count (
-		ifolder->search, expression, cancellable, error);
+		imapx_folder->search, expression, cancellable, error);
 
-	camel_imapx_search_set_server (isearch, NULL);
+	camel_imapx_search_set_server (imapx_search, NULL);
 
-	g_mutex_unlock (&ifolder->search_lock);
+	g_mutex_unlock (&imapx_folder->search_lock);
 
-	if (server != NULL)
-		g_object_unref (server);
+	g_clear_object (&imapx_server);
 
 	return matches;
 }
@@ -402,45 +382,34 @@ imapx_search_by_expression (CamelFolder
                             GCancellable *cancellable,
                             GError **error)
 {
-	CamelIMAPXFolder *ifolder;
-	CamelIMAPXSearch *isearch;
-	CamelIMAPXServer *server = NULL;
-	CamelStore *parent_store;
+	CamelIMAPXStore *imapx_store;
+	CamelIMAPXFolder *imapx_folder;
+	CamelIMAPXSearch *imapx_search;
+	CamelIMAPXServer *imapx_server;
+	CamelStore *store;
 	GPtrArray *matches;
-	const gchar *folder_name;
-	gboolean online;
-
-	ifolder = CAMEL_IMAPX_FOLDER (folder);
-	folder_name = camel_folder_get_full_name (folder);
-	parent_store = camel_folder_get_parent_store (folder);
 
-	online = camel_offline_store_get_online (
-		CAMEL_OFFLINE_STORE (parent_store));
+	imapx_folder = CAMEL_IMAPX_FOLDER (folder);
+	store = camel_folder_get_parent_store (folder);
 
-	if (online) {
-		/* do not panic when the server cannot be reached for whatever reason,
-		 * show offline data at least */
-		server = camel_imapx_store_get_server (
-			CAMEL_IMAPX_STORE (parent_store),
-			folder_name, cancellable, NULL);
-	}
+	imapx_store = CAMEL_IMAPX_STORE (store);
+	imapx_server = camel_imapx_store_ref_server (imapx_store, NULL);
 
-	g_mutex_lock (&ifolder->search_lock);
+	g_mutex_lock (&imapx_folder->search_lock);
 
-	isearch = CAMEL_IMAPX_SEARCH (ifolder->search);
-	camel_imapx_search_set_server (isearch, server);
+	imapx_search = CAMEL_IMAPX_SEARCH (imapx_folder->search);
+	camel_imapx_search_set_server (imapx_search, imapx_server);
 
-	camel_folder_search_set_folder (ifolder->search, folder);
+	camel_folder_search_set_folder (imapx_folder->search, folder);
 
 	matches = camel_folder_search_search (
-		ifolder->search, expression, NULL, cancellable, error);
+		imapx_folder->search, expression, NULL, cancellable, error);
 
-	camel_imapx_search_set_server (isearch, NULL);
+	camel_imapx_search_set_server (imapx_search, NULL);
 
-	g_mutex_unlock (&ifolder->search_lock);
+	g_mutex_unlock (&imapx_folder->search_lock);
 
-	if (server != NULL)
-		g_object_unref (server);
+	g_clear_object (&imapx_server);
 
 	return matches;
 }
@@ -450,9 +419,12 @@ imapx_get_filename (CamelFolder *folder,
                     const gchar *uid,
                     GError **error)
 {
-	CamelIMAPXFolder *ifolder = (CamelIMAPXFolder *) folder;
+	CamelIMAPXFolder *imapx_folder;
+
+	imapx_folder = CAMEL_IMAPX_FOLDER (folder);
 
-	return camel_data_cache_get_filename (ifolder->cache, "cache", uid);
+	return camel_data_cache_get_filename (
+		imapx_folder->cache, "cache", uid);
 }
 
 static gboolean
@@ -463,32 +435,27 @@ imapx_append_message_sync (CamelFolder *
                            GCancellable *cancellable,
                            GError **error)
 {
-	CamelStore *parent_store;
-	CamelIMAPXStore *istore;
-	CamelIMAPXServer *server;
+	CamelStore *store;
+	CamelIMAPXStore *imapx_store;
+	CamelIMAPXServer *imapx_server;
 	gboolean success = FALSE;
 
-	parent_store = camel_folder_get_parent_store (folder);
-	istore = CAMEL_IMAPX_STORE (parent_store);
+	store = camel_folder_get_parent_store (folder);
 
-	if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (istore))) {
-		g_set_error (
-			error, CAMEL_SERVICE_ERROR,
-			CAMEL_SERVICE_ERROR_UNAVAILABLE,
-			_("You must be working online to complete this operation"));
-		return FALSE;
-	}
+	imapx_store = CAMEL_IMAPX_STORE (store);
+	imapx_server = camel_imapx_store_ref_server (imapx_store, error);
 
-	if (appended_uid)
+	if (appended_uid != NULL)
 		*appended_uid = NULL;
 
-	server = camel_imapx_store_get_server (istore, NULL, cancellable, error);
-	if (server) {
+	if (imapx_server != NULL) {
 		success = camel_imapx_server_append_message (
-			server, folder, message, info, appended_uid, cancellable, error);
-		g_object_unref (server);
+			imapx_server, folder, message, info,
+			appended_uid, cancellable, error);
 	}
 
+	g_clear_object (&imapx_server);
+
 	return success;
 }
 
@@ -497,33 +464,23 @@ imapx_expunge_sync (CamelFolder *folder,
                     GCancellable *cancellable,
                     GError **error)
 {
-	CamelStore *parent_store;
-	CamelIMAPXStore *istore;
-	CamelIMAPXServer *server;
-	const gchar *folder_name;
+	CamelStore *store;
+	CamelIMAPXStore *imapx_store;
+	CamelIMAPXServer *imapx_server;
 	gboolean success = FALSE;
 
-	folder_name = camel_folder_get_full_name (folder);
-	parent_store = camel_folder_get_parent_store (folder);
-	istore = CAMEL_IMAPX_STORE (parent_store);
+	store = camel_folder_get_parent_store (folder);
 
-	if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (istore))) {
-		g_set_error (
-			error, CAMEL_SERVICE_ERROR,
-			CAMEL_SERVICE_ERROR_UNAVAILABLE,
-			_("You must be working online to complete this operation"));
-		return FALSE;
-	}
+	imapx_store = CAMEL_IMAPX_STORE (store);
+	imapx_server = camel_imapx_store_ref_server (imapx_store, error);
 
-	server = camel_imapx_store_get_server (
-		istore, folder_name, cancellable, error);
-	if (server != NULL) {
+	if (imapx_server != NULL) {
 		success = camel_imapx_server_expunge (
-			server, folder, cancellable, error);
-		camel_imapx_store_op_done (istore, server, folder_name);
-		g_object_unref (server);
+			imapx_server, folder, cancellable, error);
 	}
 
+	g_clear_object (&imapx_server);
+
 	return success;
 }
 
@@ -534,38 +491,23 @@ imapx_fetch_messages_sync (CamelFolder *
                            GCancellable *cancellable,
                            GError **error)
 {
-	CamelService *service;
-	CamelStore *parent_store;
-	CamelIMAPXStore *istore;
-	CamelIMAPXServer *server;
-	const gchar *folder_name;
+	CamelStore *store;
+	CamelIMAPXStore *imapx_store;
+	CamelIMAPXServer *imapx_server;
 	gboolean success = FALSE;
 
-	folder_name = camel_folder_get_full_name (folder);
-	parent_store = camel_folder_get_parent_store (folder);
-	istore = CAMEL_IMAPX_STORE (parent_store);
-	service = CAMEL_SERVICE (parent_store);
+	store = camel_folder_get_parent_store (folder);
 
-	if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (istore))) {
-		g_set_error (
-			error, CAMEL_SERVICE_ERROR,
-			CAMEL_SERVICE_ERROR_UNAVAILABLE,
-			_("You must be working online to complete this operation"));
-		return FALSE;
-	}
+	imapx_store = CAMEL_IMAPX_STORE (store);
+	imapx_server = camel_imapx_store_ref_server (imapx_store, error);
 
-	if (!camel_service_connect_sync (service, cancellable, error))
-		return FALSE;
-
-	server = camel_imapx_store_get_server (
-		istore, folder_name, cancellable, error);
-	if (server != NULL) {
+	if (imapx_server != NULL) {
 		success = camel_imapx_server_fetch_messages (
-			server, folder, type, limit, cancellable, error);
-		camel_imapx_store_op_done (istore, server, folder_name);
-		g_object_unref (server);
+			imapx_server, folder, type, limit, cancellable, error);
 	}
 
+	g_clear_object (&imapx_server);
+
 	return success;
 }
 
@@ -577,17 +519,13 @@ imapx_get_message_sync (CamelFolder *fol
 {
 	CamelMimeMessage *msg = NULL;
 	CamelStream *stream = NULL;
-	CamelStore *parent_store;
-	CamelIMAPXStore *istore;
-	CamelIMAPXFolder *ifolder = (CamelIMAPXFolder *) folder;
-	CamelIMAPXServer *server;
-	const gchar *folder_name;
+	CamelStore *store;
+	CamelIMAPXFolder *imapx_folder;
 	const gchar *path = NULL;
 	gboolean offline_message = FALSE;
 
-	folder_name = camel_folder_get_full_name (folder);
-	parent_store = camel_folder_get_parent_store (folder);
-	istore = CAMEL_IMAPX_STORE (parent_store);
+	imapx_folder = CAMEL_IMAPX_FOLDER (folder);
+	store = camel_folder_get_parent_store (folder);
 
 	if (!strchr (uid, '-'))
 		path = "cur";
@@ -596,8 +534,10 @@ imapx_get_message_sync (CamelFolder *fol
 		offline_message = TRUE;
 	}
 
-	stream = camel_data_cache_get (ifolder->cache, path, uid, NULL);
+	stream = camel_data_cache_get (imapx_folder->cache, path, uid, NULL);
 	if (stream == NULL) {
+		CamelIMAPXServer *imapx_server;
+
 		if (offline_message) {
 			g_set_error (
 				error, CAMEL_FOLDER_ERROR,
@@ -606,23 +546,15 @@ imapx_get_message_sync (CamelFolder *fol
 			return NULL;
 		}
 
-		if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (istore))) {
-			g_set_error (
-				error, CAMEL_SERVICE_ERROR,
-				CAMEL_SERVICE_ERROR_UNAVAILABLE,
-				_("You must be working online to complete this operation"));
-			return NULL;
-		}
+		imapx_server = camel_imapx_store_ref_server (
+			CAMEL_IMAPX_STORE (store), error);
 
-		server = camel_imapx_store_get_server (
-			istore, folder_name, cancellable, error);
-		if (server == NULL)
-			return NULL;
+		if (imapx_server != NULL) {
+			stream = camel_imapx_server_get_message (
+				imapx_server, folder, uid, cancellable, error);
+		}
 
-		stream = camel_imapx_server_get_message (
-			server, folder, uid, cancellable, error);
-		camel_imapx_store_op_done (istore, server, folder_name);
-		g_object_unref (server);
+		g_clear_object (&imapx_server);
 	}
 
 	if (stream != NULL) {
@@ -630,14 +562,14 @@ imapx_get_message_sync (CamelFolder *fol
 
 		msg = camel_mime_message_new ();
 
-		g_mutex_lock (&ifolder->stream_lock);
+		g_mutex_lock (&imapx_folder->stream_lock);
 		success = camel_data_wrapper_construct_from_stream_sync (
 			CAMEL_DATA_WRAPPER (msg), stream, cancellable, error);
 		if (!success) {
 			g_object_unref (msg);
 			msg = NULL;
 		}
-		g_mutex_unlock (&ifolder->stream_lock);
+		g_mutex_unlock (&imapx_folder->stream_lock);
 		g_object_unref (stream);
 	}
 
@@ -670,26 +602,27 @@ imapx_get_quota_info_sync (CamelFolder *
                            GCancellable *cancellable,
                            GError **error)
 {
-	CamelStore *parent_store;
-	CamelIMAPXServer *server;
+	CamelStore *store;
+	CamelIMAPXStore *imapx_store;
+	CamelIMAPXServer *imapx_server;
 	CamelFolderQuotaInfo *quota_info = NULL;
 	const gchar *folder_name;
 	gchar **quota_root_names;
 	gboolean success = FALSE;
 
+	store = camel_folder_get_parent_store (folder);
 	folder_name = camel_folder_get_full_name (folder);
-	parent_store = camel_folder_get_parent_store (folder);
 
-	server = camel_imapx_store_get_server (
-		CAMEL_IMAPX_STORE (parent_store),
-		folder_name, cancellable, error);
+	imapx_store = CAMEL_IMAPX_STORE (store);
+	imapx_server = camel_imapx_store_ref_server (imapx_store, error);
 
-	if (server != NULL) {
+	if (imapx_server != NULL) {
 		success = camel_imapx_server_update_quota_info (
-			server, folder_name, cancellable, error);
-		g_object_unref (server);
+			imapx_server, folder_name, cancellable, error);
 	}
 
+	g_clear_object (&imapx_server);
+
 	if (!success)
 		return NULL;
 
@@ -699,7 +632,7 @@ imapx_get_quota_info_sync (CamelFolder *
 	/* XXX Just return info for the first quota root name, I guess. */
 	if (quota_root_names != NULL && quota_root_names[0] != NULL)
 		quota_info = camel_imapx_store_dup_quota_info (
-			CAMEL_IMAPX_STORE (parent_store),
+			CAMEL_IMAPX_STORE (store),
 			quota_root_names[0]);
 
 	g_strfreev (quota_root_names);
@@ -729,44 +662,29 @@ imapx_refresh_info_sync (CamelFolder *fo
                          GCancellable *cancellable,
                          GError **error)
 {
-	CamelService *service;
-	CamelStore *parent_store;
-	CamelIMAPXStore *istore;
-	CamelIMAPXServer *server;
-	const gchar *folder_name;
+	CamelStore *store;
+	CamelIMAPXStore *imapx_store;
+	CamelIMAPXServer *imapx_server;
 	gboolean success = FALSE;
 
-	folder_name = camel_folder_get_full_name (folder);
-	parent_store = camel_folder_get_parent_store (folder);
-	istore = CAMEL_IMAPX_STORE (parent_store);
-	service = CAMEL_SERVICE (parent_store);
+	store = camel_folder_get_parent_store (folder);
 
-	if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (istore))) {
-		g_set_error (
-			error, CAMEL_SERVICE_ERROR,
-			CAMEL_SERVICE_ERROR_UNAVAILABLE,
-			_("You must be working online to complete this operation"));
-		return FALSE;
-	}
+	imapx_store = CAMEL_IMAPX_STORE (store);
+	imapx_server = camel_imapx_store_ref_server (imapx_store, error);
 
-	if (!camel_service_connect_sync (service, cancellable, error))
-		return FALSE;
-
-	server = camel_imapx_store_get_server (
-		istore, folder_name, cancellable, error);
-	if (server != NULL) {
+	if (imapx_server != NULL) {
 		success = camel_imapx_server_refresh_info (
-			server, folder, cancellable, error);
-		camel_imapx_store_op_done (istore, server, folder_name);
-		g_object_unref (server);
+			imapx_server, folder, cancellable, error);
 	}
 
+	g_clear_object (&imapx_server);
+
 	return success;
 }
 
 /* Helper for imapx_synchronize_sync() */
 static gboolean
-imapx_move_to_real_junk (CamelIMAPXServer *server,
+imapx_move_to_real_junk (CamelIMAPXServer *imapx_server,
                          CamelFolder *folder,
                          GCancellable *cancellable,
                          gboolean *out_need_to_expunge,
@@ -782,7 +700,7 @@ imapx_move_to_real_junk (CamelIMAPXServe
 	uids_to_copy = g_ptr_array_new_with_free_func (
 		(GDestroyNotify) camel_pstring_free);
 
-	settings = camel_imapx_server_ref_settings (server);
+	settings = camel_imapx_server_ref_settings (imapx_server);
 	if (camel_imapx_settings_get_use_real_junk_path (settings)) {
 		real_junk_path =
 			camel_imapx_settings_dup_real_junk_path (settings);
@@ -795,7 +713,7 @@ imapx_move_to_real_junk (CamelIMAPXServe
 		CamelFolder *destination = NULL;
 		CamelIMAPXStore *store;
 
-		store = camel_imapx_server_ref_store (server);
+		store = camel_imapx_server_ref_store (imapx_server);
 
 		if (real_junk_path != NULL) {
 			destination = camel_store_get_folder_sync (
@@ -814,7 +732,8 @@ imapx_move_to_real_junk (CamelIMAPXServe
 			success = TRUE;
 		} else if (destination != NULL) {
 			success = camel_imapx_server_copy_message (
-				server, folder, destination,
+				imapx_server,
+				folder, destination,
 				uids_to_copy, TRUE,
 				cancellable, error);
 			*out_need_to_expunge = success;
@@ -839,7 +758,7 @@ imapx_move_to_real_junk (CamelIMAPXServe
 
 /* Helper for imapx_synchronize_sync() */
 static gboolean
-imapx_move_to_real_trash (CamelIMAPXServer *server,
+imapx_move_to_real_trash (CamelIMAPXServer *imapx_server,
                           CamelFolder *folder,
                           GCancellable *cancellable,
                           gboolean *out_need_to_expunge,
@@ -855,7 +774,7 @@ imapx_move_to_real_trash (CamelIMAPXServ
 	uids_to_copy = g_ptr_array_new_with_free_func (
 		(GDestroyNotify) camel_pstring_free);
 
-	settings = camel_imapx_server_ref_settings (server);
+	settings = camel_imapx_server_ref_settings (imapx_server);
 	if (camel_imapx_settings_get_use_real_trash_path (settings)) {
 		real_trash_path =
 			camel_imapx_settings_dup_real_trash_path (settings);
@@ -868,7 +787,7 @@ imapx_move_to_real_trash (CamelIMAPXServ
 		CamelFolder *destination = NULL;
 		CamelIMAPXStore *store;
 
-		store = camel_imapx_server_ref_store (server);
+		store = camel_imapx_server_ref_store (imapx_server);
 
 		if (real_trash_path != NULL) {
 			destination = camel_store_get_folder_sync (
@@ -887,7 +806,8 @@ imapx_move_to_real_trash (CamelIMAPXServ
 			success = TRUE;
 		} else if (destination != NULL) {
 			success = camel_imapx_server_copy_message (
-				server, folder, destination,
+				imapx_server,
+				folder, destination,
 				uids_to_copy, TRUE,
 				cancellable, error);
 			*out_need_to_expunge = success;
@@ -916,42 +836,32 @@ imapx_synchronize_sync (CamelFolder *fol
                         GCancellable *cancellable,
                         GError **error)
 {
-	CamelStore *parent_store;
-	CamelIMAPXStore *istore;
-	CamelIMAPXServer *server;
-	const gchar *folder_name;
+	CamelStore *store;
+	CamelIMAPXStore *imapx_store;
+	CamelIMAPXServer *imapx_server;
 	gboolean success = FALSE;
 
-	folder_name = camel_folder_get_full_name (folder);
-	parent_store = camel_folder_get_parent_store (folder);
-	istore = CAMEL_IMAPX_STORE (parent_store);
+	store = camel_folder_get_parent_store (folder);
 
-	if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (istore))) {
-		g_set_error (
-			error, CAMEL_SERVICE_ERROR,
-			CAMEL_SERVICE_ERROR_UNAVAILABLE,
-			_("You must be working online to complete this operation"));
-		return FALSE;
-	}
+	imapx_store = CAMEL_IMAPX_STORE (store);
+	imapx_server = camel_imapx_store_ref_server (imapx_store, error);
 
-	server = camel_imapx_store_get_server (
-		istore, folder_name, cancellable, error);
-	if (server != NULL) {
+	if (imapx_server != NULL) {
 		gboolean need_to_expunge;
 
 		success = camel_imapx_server_sync_changes (
-			server, folder, cancellable, error);
+			imapx_server, folder, cancellable, error);
 
 		if (success) {
 			success = imapx_move_to_real_junk (
-				server, folder, cancellable,
+				imapx_server, folder, cancellable,
 				&need_to_expunge, error);
 			expunge |= need_to_expunge;
 		}
 
 		if (success) {
 			success = imapx_move_to_real_trash (
-				server, folder, cancellable,
+				imapx_server, folder, cancellable,
 				&need_to_expunge, error);
 			expunge |= need_to_expunge;
 		}
@@ -961,12 +871,11 @@ imapx_synchronize_sync (CamelFolder *fol
 
 		if (success && expunge)
 			success = camel_imapx_server_expunge (
-				server, folder, cancellable, error);
-
-		camel_imapx_store_op_done (istore, server, folder_name);
-		g_object_unref (server);
+				imapx_server, folder, cancellable, error);
 	}
 
+	g_clear_object (&imapx_server);
+
 	return success;
 }
 
@@ -976,33 +885,23 @@ imapx_synchronize_message_sync (CamelFol
                                 GCancellable *cancellable,
                                 GError **error)
 {
-	CamelStore *parent_store;
-	CamelIMAPXStore *istore;
-	CamelIMAPXServer *server;
-	const gchar *folder_name;
+	CamelStore *store;
+	CamelIMAPXStore *imapx_store;
+	CamelIMAPXServer *imapx_server;
 	gboolean success = FALSE;
 
-	folder_name = camel_folder_get_full_name (folder);
-	parent_store = camel_folder_get_parent_store (folder);
-	istore = CAMEL_IMAPX_STORE (parent_store);
+	store = camel_folder_get_parent_store (folder);
 
-	if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (istore))) {
-		g_set_error (
-			error, CAMEL_SERVICE_ERROR,
-			CAMEL_SERVICE_ERROR_UNAVAILABLE,
-			_("You must be working online to complete this operation"));
-		return FALSE;
-	}
+	imapx_store = CAMEL_IMAPX_STORE (store);
+	imapx_server = camel_imapx_store_ref_server (imapx_store, error);
 
-	server = camel_imapx_store_get_server (
-		istore, folder_name, cancellable, error);
-	if (server != NULL) {
+	if (imapx_server != NULL) {
 		success = camel_imapx_server_sync_message (
-			server, folder, uid, cancellable, error);
-		camel_imapx_store_op_done (istore, server, folder_name);
-		g_object_unref (server);
+			imapx_server, folder, uid, cancellable, error);
 	}
 
+	g_clear_object (&imapx_server);
+
 	return success;
 }
 
@@ -1015,39 +914,29 @@ imapx_transfer_messages_to_sync (CamelFo
                                  GCancellable *cancellable,
                                  GError **error)
 {
-	CamelStore *parent_store;
-	CamelIMAPXStore *istore;
-	CamelIMAPXServer *server;
-	const gchar *folder_name;
+	CamelStore *store;
+	CamelIMAPXStore *imapx_store;
+	CamelIMAPXServer *imapx_server;
 	gboolean success = FALSE;
 
-	folder_name = camel_folder_get_full_name (source);
-	parent_store = camel_folder_get_parent_store (source);
-	istore = CAMEL_IMAPX_STORE (parent_store);
+	store = camel_folder_get_parent_store (source);
 
-	if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (istore))) {
-		g_set_error (
-			error, CAMEL_SERVICE_ERROR,
-			CAMEL_SERVICE_ERROR_UNAVAILABLE,
-			_("You must be working online to complete this operation"));
-		return FALSE;
-	}
+	imapx_store = CAMEL_IMAPX_STORE (store);
+	imapx_server = camel_imapx_store_ref_server (imapx_store, error);
 
-	server = camel_imapx_store_get_server (
-		istore, folder_name, cancellable, error);
-	if (server != NULL) {
+	if (imapx_server != NULL) {
 		success = camel_imapx_server_copy_message (
-			server, source, dest, uids,
+			imapx_server, source, dest, uids,
 			delete_originals, cancellable, error);
-		camel_imapx_store_op_done (istore, server, folder_name);
-		g_object_unref (server);
+
+		/* Update destination folder only if it's not frozen,
+		 * to avoid updating for each "move" action on a single
+		 * message while filtering. */
+		if (!camel_folder_is_frozen (dest))
+			imapx_refresh_info_sync (dest, cancellable, NULL);
 	}
 
-	/* update destination folder only if not frozen, to not update
-	 * for each single message transfer during filtering
-	 */
-	if (!camel_folder_is_frozen (dest))
-		imapx_refresh_info_sync (dest, cancellable, NULL);
+	g_clear_object (&imapx_server);
 
 	return success;
 }
@@ -1056,15 +945,15 @@ static void
 imapx_rename (CamelFolder *folder,
               const gchar *new_name)
 {
-	CamelStore *parent_store;
-	CamelIMAPXStore *istore;
+	CamelStore *store;
+	CamelIMAPXStore *imapx_store;
 	const gchar *folder_name;
 
-	parent_store = camel_folder_get_parent_store (folder);
-	istore = CAMEL_IMAPX_STORE (parent_store);
+	store = camel_folder_get_parent_store (folder);
+	imapx_store = CAMEL_IMAPX_STORE (store);
 
 	camel_store_summary_disconnect_folder_summary (
-		CAMEL_STORE_SUMMARY (istore->summary),
+		CAMEL_STORE_SUMMARY (imapx_store->summary),
 		folder->summary);
 
 	/* Chain up to parent's rename() method. */
@@ -1074,7 +963,7 @@ imapx_rename (CamelFolder *folder,
 	folder_name = camel_folder_get_full_name (folder);
 
 	camel_store_summary_connect_folder_summary (
-		CAMEL_STORE_SUMMARY (istore->summary),
+		CAMEL_STORE_SUMMARY (imapx_store->summary),
 		folder_name, folder->summary);
 }
 
@@ -1182,7 +1071,7 @@ camel_imapx_folder_new (CamelStore *stor
 	CamelFolder *folder;
 	CamelService *service;
 	CamelSettings *settings;
-	CamelIMAPXFolder *ifolder;
+	CamelIMAPXFolder *imapx_folder;
 	const gchar *short_name;
 	gchar *state_file;
 	gboolean filter_all;
@@ -1217,12 +1106,9 @@ camel_imapx_folder_new (CamelStore *stor
 		"display-name", short_name,
 		"full_name", folder_name,
 		"parent-store", store, NULL);
-	ifolder = (CamelIMAPXFolder *) folder;
-
-	((CamelIMAPXFolder *) folder)->raw_name = g_strdup (folder_name);
 
 	folder->summary = camel_imapx_summary_new (folder);
-	if (!folder->summary) {
+	if (folder->summary == NULL) {
 		g_set_error (
 			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Could not create folder summary for %s"),
@@ -1230,8 +1116,9 @@ camel_imapx_folder_new (CamelStore *stor
 		return NULL;
 	}
 
-	ifolder->cache = camel_data_cache_new (folder_dir, error);
-	if (!ifolder->cache) {
+	imapx_folder = CAMEL_IMAPX_FOLDER (folder);
+	imapx_folder->cache = camel_data_cache_new (folder_dir, error);
+	if (imapx_folder->cache == NULL) {
 		g_prefix_error (
 			error, _("Could not create cache for %s: "),
 			short_name);
@@ -1243,25 +1130,33 @@ camel_imapx_folder_new (CamelStore *stor
 	g_free (state_file);
 	camel_object_state_read (CAMEL_OBJECT (folder));
 
-	ifolder->search = camel_imapx_search_new ();
-	g_mutex_init (&ifolder->search_lock);
-	g_mutex_init (&ifolder->stream_lock);
-	ifolder->ignore_recent = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, NULL);
-	ifolder->exists_on_server = 0;
-	ifolder->unread_on_server = 0;
-	ifolder->modseq_on_server = 0;
-	ifolder->uidnext_on_server = 0;
+	imapx_folder->search = camel_imapx_search_new ();
+	g_mutex_init (&imapx_folder->search_lock);
+	g_mutex_init (&imapx_folder->stream_lock);
+	imapx_folder->ignore_recent = g_hash_table_new_full (
+		(GHashFunc) g_str_hash,
+		(GEqualFunc) g_str_equal,
+		(GDestroyNotify) g_free,
+		(GDestroyNotify) NULL);
+	imapx_folder->exists_on_server = 0;
+	imapx_folder->unread_on_server = 0;
+	imapx_folder->modseq_on_server = 0;
+	imapx_folder->uidnext_on_server = 0;
+
+	if (filter_all)
+		folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT;
 
-	if (!g_ascii_strcasecmp (folder_name, "INBOX")) {
-		if (filter_inbox || filter_all)
+	if (g_ascii_strcasecmp (folder_name, "INBOX") == 0) {
+		if (filter_inbox)
 			folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT;
+
 		if (filter_junk)
 			folder->folder_flags |= CAMEL_FOLDER_FILTER_JUNK;
 	} else {
 		if (filter_junk && !filter_junk_inbox)
 			folder->folder_flags |= CAMEL_FOLDER_FILTER_JUNK;
 
-		if (filter_all || imapx_folder_get_apply_filters (ifolder))
+		if (imapx_folder_get_apply_filters (imapx_folder))
 			folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT;
 	}
 
diff -up evolution-data-server-3.8.5/camel/camel-imapx-folder.h.kill-imapx-conn-manager evolution-data-server-3.8.5/camel/camel-imapx-folder.h
--- evolution-data-server-3.8.5/camel/camel-imapx-folder.h.kill-imapx-conn-manager	2013-07-23 07:57:54.000000000 -0400
+++ evolution-data-server-3.8.5/camel/camel-imapx-folder.h	2013-09-12 15:51:33.331412252 -0400
@@ -62,7 +62,6 @@ struct _CamelIMAPXFolder {
 	CamelOfflineFolder parent;
 	CamelIMAPXFolderPrivate *priv;
 
-	gchar *raw_name;
 	CamelDataCache *cache;
 	CamelFolderSearch *search;
 
diff -up evolution-data-server-3.8.5/camel/camel-imapx-server.c.kill-imapx-conn-manager evolution-data-server-3.8.5/camel/camel-imapx-server.c
--- evolution-data-server-3.8.5/camel/camel-imapx-server.c.kill-imapx-conn-manager	2013-07-23 07:57:58.000000000 -0400
+++ evolution-data-server-3.8.5/camel/camel-imapx-server.c	2013-09-12 15:51:33.348412247 -0400
@@ -351,14 +351,6 @@ enum {
 	PROP_STORE
 };
 
-enum {
-	SELECT_CHANGED,
-	SHUTDOWN,
-	LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL];
-
 static void	imapx_uidset_init		(struct _uidset_state *ss,
 						 gint total,
 						 gint limit);
@@ -2297,9 +2289,7 @@ imapx_untagged_bye (CamelIMAPXServer *is
                     GCancellable *cancellable,
                     GError **error)
 {
-	CamelIMAPXStore *imapx_store;
-	CamelService *service;
-	CamelServiceConnectionStatus status;
+	CamelIMAPXStore *store;
 	guchar *token = NULL;
 
 	g_return_val_if_fail (CAMEL_IS_IMAPX_SERVER (is), FALSE);
@@ -2317,18 +2307,11 @@ imapx_untagged_bye (CamelIMAPXServer *is
 
 	is->state = IMAPX_SHUTDOWN;
 
-	imapx_store = camel_imapx_server_ref_store (is);
-	service = CAMEL_SERVICE (imapx_store);
-	status = camel_service_get_connection_status (service);
-
-	/* Do not disconnect the service if we're still connecting.
-	 * camel_service_disconnect_sync() will cancel the connect
-	 * operation and the server message will get replaced with
-	 * a generic "Operation was cancelled" message. */
-	if (status == CAMEL_SERVICE_CONNECTED)
-		camel_service_disconnect_sync (service, FALSE, NULL, NULL);
-
-	g_object_unref (imapx_store);
+	/* Disconnect the CamelIMAPXStore. */
+	store = camel_imapx_server_ref_store (is);
+	camel_service_disconnect_sync (
+		CAMEL_SERVICE (store), FALSE, NULL, NULL);
+	g_object_unref (store);
 
 	return FALSE;
 }
@@ -3469,7 +3452,6 @@ imapx_command_select_done (CamelIMAPXSer
                            GCancellable *cancellable,
                            GError **error)
 {
-	const gchar *selected_folder = NULL;
 	gboolean success = TRUE;
 	GError *local_error = NULL;
 
@@ -3580,7 +3562,6 @@ imapx_command_select_done (CamelIMAPXSer
 			;
 		}
 		ifolder->uidvalidity_on_server = is->uidvalidity;
-		selected_folder = camel_folder_get_full_name (folder);
 
 		if (is->uidvalidity && is->uidvalidity != ((CamelIMAPXSummary *) folder->summary)->validity)
 			invalidate_local_cache (ifolder, is->uidvalidity);
@@ -3599,8 +3580,6 @@ imapx_command_select_done (CamelIMAPXSer
 
 	camel_imapx_command_unref (ic);
 
-	g_signal_emit (is, signals[SELECT_CHANGED], 0, selected_folder);
-
 	return success;
 }
 
@@ -6874,6 +6853,7 @@ imapx_parser_thread (gpointer d)
 {
 	CamelIMAPXServer *is = d;
 	CamelIMAPXStream *stream;
+	CamelIMAPXStore *store;
 	GCancellable *cancellable;
 	gboolean have_stream;
 	GError *local_error = NULL;
@@ -6965,8 +6945,6 @@ imapx_parser_thread (gpointer d)
 
 	cancel_all_jobs (is, local_error);
 
-	g_clear_error (&local_error);
-
 	QUEUE_LOCK (is);
 	if (is->cancellable != NULL) {
 		g_object_unref (is->cancellable);
@@ -6976,7 +6954,14 @@ imapx_parser_thread (gpointer d)
 	QUEUE_UNLOCK (is);
 
 	is->parser_quit = FALSE;
-	g_signal_emit (is, signals[SHUTDOWN], 0);
+
+	/* Disconnect the CamelService. */
+	store = camel_imapx_server_ref_store (is);
+	camel_service_disconnect_sync (
+		CAMEL_SERVICE (store), FALSE, NULL, NULL);
+	g_object_unref (store);
+
+	g_clear_error (&local_error);
 
 	return NULL;
 }
@@ -7141,9 +7126,6 @@ camel_imapx_server_class_init (CamelIMAP
 	object_class->dispose = imapx_server_dispose;
 	object_class->constructed = imapx_server_constructed;
 
-	class->select_changed = NULL;
-	class->shutdown = NULL;
-
 	g_object_class_install_property (
 		object_class,
 		PROP_STREAM,
@@ -7167,32 +7149,6 @@ camel_imapx_server_class_init (CamelIMAP
 			G_PARAM_CONSTRUCT_ONLY |
 			G_PARAM_STATIC_STRINGS));
 
-	/**
-	 * CamelIMAPXServer::select_changed
-	 * @server: the #CamelIMAPXServer which emitted the signal
-	 **/
-	signals[SELECT_CHANGED] = g_signal_new (
-		"select_changed",
-		G_OBJECT_CLASS_TYPE (class),
-		G_SIGNAL_RUN_FIRST,
-		G_STRUCT_OFFSET (CamelIMAPXServerClass, select_changed),
-		NULL, NULL,
-		g_cclosure_marshal_VOID__STRING,
-		G_TYPE_NONE, 1, G_TYPE_STRING);
-
-	/**
-	 * CamelIMAPXServer::shutdown
-	 * @server: the #CamelIMAPXServer which emitted the signal
-	 **/
-	signals[SHUTDOWN] = g_signal_new (
-		"shutdown",
-		G_OBJECT_CLASS_TYPE (class),
-		G_SIGNAL_RUN_FIRST,
-		G_STRUCT_OFFSET (CamelIMAPXServerClass, shutdown),
-		NULL, NULL,
-		g_cclosure_marshal_VOID__VOID,
-		G_TYPE_NONE, 0);
-
 	class->tagprefix = 'A';
 }
 
diff -up evolution-data-server-3.8.5/camel/camel-imapx-server.h.kill-imapx-conn-manager evolution-data-server-3.8.5/camel/camel-imapx-server.h
--- evolution-data-server-3.8.5/camel/camel-imapx-server.h.kill-imapx-conn-manager	2013-07-23 07:57:54.000000000 -0400
+++ evolution-data-server-3.8.5/camel/camel-imapx-server.h	2013-09-12 15:51:33.350412247 -0400
@@ -164,11 +164,6 @@ struct _CamelIMAPXServer {
 struct _CamelIMAPXServerClass {
 	CamelObjectClass parent_class;
 
-	/* Signals */
-	void	(*select_changed)	(CamelIMAPXServer *is,
-					 const gchar *selected_folder);
-	void	(*shutdown)		(CamelIMAPXServer *is);
-
 	gchar tagprefix;
 };
 
diff -up evolution-data-server-3.8.5/camel/camel-imapx-store.c.kill-imapx-conn-manager evolution-data-server-3.8.5/camel/camel-imapx-store.c
--- evolution-data-server-3.8.5/camel/camel-imapx-store.c.kill-imapx-conn-manager	2013-07-23 07:57:57.000000000 -0400
+++ evolution-data-server-3.8.5/camel/camel-imapx-store.c	2013-09-12 15:51:33.358412244 -0400
@@ -57,6 +57,10 @@
 	((obj), CAMEL_TYPE_IMAPX_STORE, CamelIMAPXStorePrivate))
 
 struct _CamelIMAPXStorePrivate {
+	CamelIMAPXServer *connected_server;
+	CamelIMAPXServer *connecting_server;
+	GMutex server_lock;
+
 	GHashTable *quota_info;
 	GMutex quota_info_lock;
 };
@@ -189,24 +193,10 @@ imapx_store_dispose (GObject *object)
 {
 	CamelIMAPXStore *imapx_store = CAMEL_IMAPX_STORE (object);
 
-	/* Force disconnect so we dont have it run later,
-	 * after we've cleaned up some stuff. */
-	if (imapx_store->con_man != NULL) {
-		camel_service_disconnect_sync (
-			CAMEL_SERVICE (imapx_store), TRUE, NULL, NULL);
-		g_object_unref (imapx_store->con_man);
-		imapx_store->con_man = NULL;
-	}
-
-	if (imapx_store->authenticating_server != NULL) {
-		g_object_unref (imapx_store->authenticating_server);
-		imapx_store->authenticating_server = NULL;
-	}
-
-	if (imapx_store->summary != NULL) {
-		g_object_unref (imapx_store->summary);
-		imapx_store->summary = NULL;
-	}
+	g_clear_object (&imapx_store->summary);
+
+	g_clear_object (&imapx_store->priv->connected_server);
+	g_clear_object (&imapx_store->priv->connecting_server);
 
 	/* Chain up to parent's dispose() method. */
 	G_OBJECT_CLASS (camel_imapx_store_parent_class)->dispose (object);
@@ -219,6 +209,8 @@ imapx_store_finalize (GObject *object)
 
 	g_mutex_clear (&imapx_store->get_finfo_lock);
 
+	g_mutex_clear (&imapx_store->priv->server_lock);
+
 	g_hash_table_destroy (imapx_store->priv->quota_info);
 	g_mutex_clear (&imapx_store->priv->quota_info_lock);
 
@@ -257,42 +249,48 @@ imapx_get_name (CamelService *service,
 	return name;
 }
 
-CamelIMAPXServer *
-camel_imapx_store_get_server (CamelIMAPXStore *istore,
-                              const gchar *folder_name,
-                              GCancellable *cancellable,
-                              GError **error)
-{
-	return camel_imapx_conn_manager_get_connection (
-		istore->con_man, folder_name, cancellable, error);
-}
-
-void
-camel_imapx_store_op_done (CamelIMAPXStore *istore,
-                           CamelIMAPXServer *server,
-                           const gchar *folder_name)
-{
-	g_return_if_fail (server != NULL);
-
-	camel_imapx_conn_manager_update_con_info (
-		istore->con_man, server, folder_name);
-}
-
 static gboolean
 imapx_connect_sync (CamelService *service,
                     GCancellable *cancellable,
                     GError **error)
 {
-	CamelIMAPXStore *istore = (CamelIMAPXStore *) service;
-	CamelIMAPXServer *server;
+	CamelIMAPXStore *imapx_store;
+	CamelIMAPXServer *imapx_server;
+	gboolean success;
 
-	server = camel_imapx_store_get_server (istore, NULL, cancellable, error);
-	if (server) {
-		g_object_unref (server);
-		return TRUE;
+	imapx_store = CAMEL_IMAPX_STORE (service);
+	imapx_server = camel_imapx_server_new (imapx_store);
+
+	g_mutex_lock (&imapx_store->priv->server_lock);
+
+	/* We need to share the CamelIMAPXServer instance with the
+	 * authenticate_sync() method, but we don't want other parts
+	 * getting at it just yet.  So stash it in a special private
+	 * variable while connecting to the IMAP server. */
+	g_warn_if_fail (imapx_store->priv->connecting_server == NULL);
+	imapx_store->priv->connecting_server = g_object_ref (imapx_server);
+
+	g_mutex_unlock (&imapx_store->priv->server_lock);
+
+	success = camel_imapx_server_connect (
+		imapx_server, cancellable, error);
+
+	g_mutex_lock (&imapx_store->priv->server_lock);
+
+	g_warn_if_fail (imapx_store->priv->connecting_server == imapx_server);
+	g_clear_object (&imapx_store->priv->connecting_server);
+
+	if (success) {
+		g_clear_object (&imapx_store->priv->connected_server);
+		imapx_store->priv->connected_server = imapx_server;
+		g_object_ref (imapx_server);
 	}
 
-	return FALSE;
+	g_mutex_unlock (&imapx_store->priv->server_lock);
+
+	g_clear_object (&imapx_server);
+
+	return success;
 }
 
 static gboolean
@@ -301,15 +299,16 @@ imapx_disconnect_sync (CamelService *ser
                        GCancellable *cancellable,
                        GError **error)
 {
-	CamelIMAPXStore *istore = CAMEL_IMAPX_STORE (service);
-	CamelServiceClass *service_class;
+	CamelIMAPXStore *imapx_store;
 
-	service_class = CAMEL_SERVICE_CLASS (camel_imapx_store_parent_class);
-	if (!service_class->disconnect_sync (service, clean, cancellable, error))
-		return FALSE;
+	imapx_store = CAMEL_IMAPX_STORE (service);
+
+	g_mutex_lock (&imapx_store->priv->server_lock);
 
-	if (istore->con_man != NULL)
-		camel_imapx_conn_manager_close_connections (istore->con_man);
+	g_warn_if_fail (imapx_store->priv->connecting_server == NULL);
+	g_clear_object (&imapx_store->priv->connected_server);
+
+	g_mutex_unlock (&imapx_store->priv->server_lock);
 
 	return TRUE;
 }
@@ -320,23 +319,23 @@ imapx_authenticate_sync (CamelService *s
                          GCancellable *cancellable,
                          GError **error)
 {
-	CamelIMAPXStore *istore = CAMEL_IMAPX_STORE (service);
-	CamelIMAPXServer *server;
+	CamelIMAPXStore *imapx_store;
+	CamelIMAPXServer *imapx_server;
+	CamelAuthenticationResult result;
+
+	imapx_store = CAMEL_IMAPX_STORE (service);
+
+	/* This should have been set for us by connect_sync(). */
+	g_mutex_lock (&imapx_store->priv->server_lock);
+	imapx_server = g_object_ref (imapx_store->priv->connecting_server);
+	g_mutex_unlock (&imapx_store->priv->server_lock);
+
+	result = camel_imapx_server_authenticate (
+		imapx_server, mechanism, cancellable, error);
 
-	/* CamelIMAPXConnManager sets this before calling
-	 * camel_imapx_server_connect()(), and then clears it
-	 * immediately after, all while holding the recursive
-	 * connection lock (CAMEL_SERVICE_REC_CONNECT_LOCK).
-	 * Otherwise we'd have no way of knowing which server
-	 * is trying to authenticate. */
-	server = istore->authenticating_server;
-
-	g_return_val_if_fail (
-		CAMEL_IS_IMAPX_SERVER (server),
-		CAMEL_AUTHENTICATION_REJECTED);
+	g_clear_object (&imapx_server);
 
-	return camel_imapx_server_authenticate (
-		server, mechanism, cancellable, error);
+	return result;
 }
 
 CamelServiceAuthType camel_imapx_password_authtype = {
@@ -650,62 +649,64 @@ imapx_mark_folder_subscribed (CamelIMAPX
 
 static gboolean
 imapx_subscribe_folder (CamelStore *store,
-                        const gchar *folder_name,
+                        const gchar *folder_path,
                         gboolean emit_signal,
                         GCancellable *cancellable,
                         GError **error)
 {
-	CamelIMAPXStore *istore = (CamelIMAPXStore *) store;
-	CamelIMAPXServer *server;
-	gboolean success;
+	CamelIMAPXStore *imapx_store;
+	CamelIMAPXServer *imapx_server;
+	gboolean success = FALSE;
 
-	if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store)))
-		return TRUE;
+	imapx_store = CAMEL_IMAPX_STORE (store);
+	imapx_server = camel_imapx_store_ref_server (imapx_store, error);
 
-	server = camel_imapx_store_get_server (istore, NULL, cancellable, error);
-	if (!server)
-		return FALSE;
+	if (folder_path != NULL && *folder_path == '/')
+		folder_path++;
 
-	if (folder_name && *folder_name == '/')
-		folder_name++;
+	if (imapx_server != NULL) {
+		success = camel_imapx_server_manage_subscription (
+			imapx_server, folder_path, TRUE, cancellable, error);
+	}
 
-	success = camel_imapx_server_manage_subscription (
-		server, folder_name, TRUE, cancellable, error);
-	g_object_unref (server);
+	if (success) {
+		imapx_mark_folder_subscribed (
+			imapx_store, folder_path, emit_signal);
+	}
 
-	if (success)
-		imapx_mark_folder_subscribed (istore, folder_name, emit_signal);
+	g_clear_object (&imapx_server);
 
 	return success;
 }
 
 static gboolean
 imapx_unsubscribe_folder (CamelStore *store,
-                          const gchar *folder_name,
+                          const gchar *folder_path,
                           gboolean emit_signal,
                           GCancellable *cancellable,
                           GError **error)
 {
-	CamelIMAPXStore *istore = (CamelIMAPXStore *) store;
-	CamelIMAPXServer *server;
-	gboolean success;
+	CamelIMAPXStore *imapx_store;
+	CamelIMAPXServer *imapx_server;
+	gboolean success = FALSE;
 
-	if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store)))
-		return TRUE;
+	imapx_store = CAMEL_IMAPX_STORE (store);
+	imapx_server = camel_imapx_store_ref_server (imapx_store, error);
 
-	server = camel_imapx_store_get_server (istore, NULL, cancellable, error);
-	if (!server)
-		return FALSE;
+	if (folder_path != NULL && *folder_path == '/')
+		folder_path++;
 
-	if (folder_name && *folder_name == '/')
-		folder_name++;
+	if (imapx_server != NULL) {
+		success = camel_imapx_server_manage_subscription (
+			imapx_server, folder_path, FALSE, cancellable, error);
+	}
 
-	success = camel_imapx_server_manage_subscription (
-		server, folder_name, FALSE, cancellable, error);
-	g_object_unref (server);
+	if (success) {
+		imapx_unmark_folder_subscribed (
+			imapx_store, folder_path, emit_signal);
+	}
 
-	if (success)
-		imapx_unmark_folder_subscribed (istore, folder_name, emit_signal);
+	g_clear_object (&imapx_server);
 
 	return success;
 }
@@ -1043,7 +1044,7 @@ get_namespaces (CamelIMAPXStore *istore)
 }
 
 static GHashTable *
-fetch_folders_for_namespaces (CamelIMAPXStore *istore,
+fetch_folders_for_namespaces (CamelIMAPXStore *imapx_store,
                               const gchar *pattern,
                               gboolean sync,
                               GCancellable *cancellable,
@@ -1053,15 +1054,15 @@ fetch_folders_for_namespaces (CamelIMAPX
 	GHashTable *folders = NULL;
 	GList *namespaces = NULL, *l;
 
-	server = camel_imapx_store_get_server (istore, NULL, cancellable, error);
-	if (!server)
+	server = camel_imapx_store_ref_server (imapx_store, error);
+
+	if (server == NULL)
 		return NULL;
 
 	folders = g_hash_table_new (folder_hash, folder_eq);
-	namespaces = get_namespaces (istore);
+	namespaces = get_namespaces (imapx_store);
 
-	for (l = namespaces; l != NULL; l = g_list_next (l))
-	{
+	for (l = namespaces; l != NULL; l = g_list_next (l)) {
 		CamelIMAPXStoreNamespace *ns = l->data;
 
 		while (ns) {
@@ -1085,7 +1086,7 @@ fetch_folders_for_namespaces (CamelIMAPX
 
 			flags |= CAMEL_STORE_FOLDER_INFO_RECURSIVE;
 			if (!fetch_folders_for_pattern (
-				istore, server, pat, flags, list_ext,
+				imapx_store, server, pat, flags, list_ext,
 				folders, cancellable, error)) {
 				g_free (pat);
 				goto exception;
@@ -1095,7 +1096,7 @@ fetch_folders_for_namespaces (CamelIMAPX
 				 * issue LSUB to list the subscribed folders separately */
 				flags |= CAMEL_STORE_FOLDER_INFO_SUBSCRIBED;
 				if (!fetch_folders_for_pattern (
-					istore, server, pat, flags, NULL,
+					imapx_store, server, pat, flags, NULL,
 					folders, cancellable, error)) {
 					g_free (pat);
 					goto exception;
@@ -1578,29 +1579,24 @@ imapx_store_create_folder_sync (CamelSto
 {
 	CamelStoreInfo *si;
 	CamelIMAPXStoreNamespace *ns;
-	CamelIMAPXStore *istore = (CamelIMAPXStore *) store;
-	CamelIMAPXServer *server;
+	CamelIMAPXStore *imapx_store;
+	CamelIMAPXServer *imapx_server;
 	gchar *real_name, *full_name, *parent_real;
 	CamelFolderInfo *fi = NULL;
 	gchar dir_sep = 0;
 	gboolean success;
 
-	if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store))) {
-		g_set_error (
-			error, CAMEL_SERVICE_ERROR,
-			CAMEL_SERVICE_ERROR_UNAVAILABLE,
-			_("You must be working online to complete this operation"));
-		return NULL;
-	}
+	imapx_store = CAMEL_IMAPX_STORE (store);
+	imapx_server = camel_imapx_store_ref_server (imapx_store, error);
 
-	server = camel_imapx_store_get_server (istore, NULL, cancellable, error);
-	if (!server)
+	if (imapx_server == NULL)
 		return NULL;
 
-	if (!parent_name)
+	if (parent_name == NULL)
 		parent_name = "";
 
-	ns = camel_imapx_store_summary_namespace_find_path (istore->summary, parent_name);
+	ns = camel_imapx_store_summary_namespace_find_path (
+		imapx_store->summary, parent_name);
 	if (ns)
 		dir_sep = ns->sep;
 
@@ -1613,47 +1609,56 @@ imapx_store_create_folder_sync (CamelSto
 			CAMEL_FOLDER_ERROR_INVALID_PATH,
 			_("The folder name \"%s\" is invalid because it contains the character \"%c\""),
 			folder_name, dir_sep);
-		g_object_unref (server);
-		return NULL;
+		goto exit;
 	}
 
-	parent_real = camel_imapx_store_summary_full_from_path (istore->summary, parent_name);
+	parent_real = camel_imapx_store_summary_full_from_path (
+		imapx_store->summary, parent_name);
 	if (parent_real == NULL) {
 		g_set_error (
 			error, CAMEL_FOLDER_ERROR,
 			CAMEL_FOLDER_ERROR_INVALID_STATE,
 			_("Unknown parent folder: %s"), parent_name);
-		g_object_unref (server);
-		return NULL;
+		goto exit;
 	}
 
-	si = camel_store_summary_path ((CamelStoreSummary *) istore->summary, parent_name);
+	si = camel_store_summary_path (
+		(CamelStoreSummary *) imapx_store->summary, parent_name);
 	if (si && si->flags & CAMEL_STORE_INFO_FOLDER_NOINFERIORS) {
 		g_set_error (
 			error, CAMEL_FOLDER_ERROR,
 			CAMEL_FOLDER_ERROR_INVALID_STATE,
 			_("The parent folder is not allowed to contain subfolders"));
-		g_object_unref (server);
-		return NULL;
+		goto exit;
 	}
 
 	if (si)
-		camel_store_summary_info_free ((CamelStoreSummary *) istore->summary, si);
+		camel_store_summary_info_free (
+			(CamelStoreSummary *) imapx_store->summary, si);
 
-	real_name = camel_imapx_store_summary_path_to_full (istore->summary, folder_name, dir_sep);
-	full_name = imapx_concat (istore, parent_real, real_name);
+	real_name = camel_imapx_store_summary_path_to_full (
+		imapx_store->summary, folder_name, dir_sep);
+	full_name = imapx_concat (imapx_store, parent_real, real_name);
 	g_free (real_name);
 
 	success = camel_imapx_server_create_folder (
-		server, full_name, cancellable, error);
-	g_object_unref (server);
+		imapx_server, full_name, cancellable, error);
+	g_object_unref (imapx_server);
 
 	if (success) {
+		CamelStoreSummary *summary;
 		CamelIMAPXStoreInfo *si;
+		const gchar *folder_path;
 
-		si = camel_imapx_store_summary_add_from_full (istore->summary, full_name, dir_sep);
-		camel_store_summary_save ((CamelStoreSummary *) istore->summary);
-		fi = imapx_build_folder_info (istore, camel_store_info_path (istore->summary, si));
+		summary = CAMEL_STORE_SUMMARY (imapx_store->summary);
+
+		si = camel_imapx_store_summary_add_from_full (
+			imapx_store->summary, full_name, dir_sep);
+		camel_store_summary_save (summary);
+		folder_path = camel_store_info_path (
+			summary, (CamelStoreInfo *) si);
+		fi = imapx_build_folder_info (
+			imapx_store, folder_path);
 		fi->flags |= CAMEL_FOLDER_NOCHILDREN;
 		camel_store_folder_created (store, fi);
 	}
@@ -1661,6 +1666,9 @@ imapx_store_create_folder_sync (CamelSto
 	g_free (full_name);
 	g_free (parent_real);
 
+exit:
+	g_clear_object (&imapx_server);
+
 	return fi;
 }
 
@@ -1670,29 +1678,23 @@ imapx_store_delete_folder_sync (CamelSto
                                 GCancellable *cancellable,
                                 GError **error)
 {
-	CamelIMAPXStore *istore = (CamelIMAPXStore *) store;
-	CamelIMAPXServer *server;
-	gboolean success;
+	CamelIMAPXStore *imapx_store;
+	CamelIMAPXServer *imapx_server;
+	gboolean success = FALSE;
 
-	if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store))) {
-		g_set_error (
-			error, CAMEL_SERVICE_ERROR,
-			CAMEL_SERVICE_ERROR_UNAVAILABLE,
-			_("You must be working online to complete this operation"));
-		return FALSE;
+	imapx_store = CAMEL_IMAPX_STORE (store);
+	imapx_server = camel_imapx_store_ref_server (imapx_store, error);
+
+	if (imapx_server != NULL) {
+		success = camel_imapx_server_delete_folder (
+			imapx_server, folder_name, cancellable, error);
 	}
-	/* Use INBOX connection as the implementation would try to select inbox to ensure
-	 * we are not selected on the folder being deleted */
-	server = camel_imapx_store_get_server (istore, "INBOX", cancellable, error);
-	if (!server)
-		return FALSE;
 
-	success = camel_imapx_server_delete_folder (
-		server, folder_name, cancellable, error);
-	g_object_unref (server);
+	if (success) {
+		imapx_delete_folder_from_cache (imapx_store, folder_name);
+	}
 
-	if (success)
-		imapx_delete_folder_from_cache (istore, folder_name);
+	g_clear_object (&imapx_server);
 
 	return success;
 }
@@ -1704,12 +1706,11 @@ imapx_store_rename_folder_sync (CamelSto
                                 GCancellable *cancellable,
                                 GError **error)
 {
-	CamelIMAPXStore *istore = (CamelIMAPXStore *) store;
-	CamelIMAPXServer *server;
 	CamelService *service;
 	CamelSettings *settings;
+	CamelIMAPXStore *imapx_store;
+	CamelIMAPXServer *imapx_server;
 	const gchar *user_cache_dir;
-	gchar *oldpath, *newpath, *storage_path;
 	gboolean use_subscriptions;
 	gboolean success = FALSE;
 
@@ -1723,52 +1724,52 @@ imapx_store_rename_folder_sync (CamelSto
 
 	g_object_unref (settings);
 
-	if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store))) {
-		g_set_error (
-			error, CAMEL_SERVICE_ERROR,
-			CAMEL_SERVICE_ERROR_UNAVAILABLE,
-			_("You must be working online to complete this operation"));
-		return FALSE;
-	}
+	imapx_store = CAMEL_IMAPX_STORE (store);
+	imapx_server = camel_imapx_store_ref_server (imapx_store, error);
 
-	if (use_subscriptions)
-		imapx_unsubscribe_folder (store, old, FALSE, cancellable, NULL);
+	if (imapx_server != NULL) {
+		gchar *oldpath;
+		gchar *newpath;
+		gchar *storage_path;
+
+		if (use_subscriptions)
+			imapx_unsubscribe_folder (
+				store, old, FALSE, cancellable, NULL);
 
-	/* Use INBOX connection as the implementation would try to select inbox to ensure
-	 * we are not selected on the folder being renamed */
-	server = camel_imapx_store_get_server (istore, "INBOX", cancellable, error);
-	if (server) {
 		success = camel_imapx_server_rename_folder (
-			server, old, new, cancellable, error);
-		g_object_unref (server);
-	}
-
-	if (!success) {
-		imapx_subscribe_folder (store, old, FALSE, cancellable, NULL);
-		return FALSE;
-	}
+			imapx_server, old, new, cancellable, error);
 
-	/* rename summary, and handle broken server */
-	rename_folder_info (istore, old, new);
+		if (!success) {
+			imapx_subscribe_folder (
+				store, old, FALSE, cancellable, NULL);
+			goto exit;
+		}
 
-	if (use_subscriptions)
-		success = imapx_subscribe_folder (
-			store, new, FALSE, cancellable, error);
+		/* Rename summary, and handle broken server. */
+		rename_folder_info (imapx_store, old, new);
 
-	storage_path = g_build_filename (user_cache_dir, "folders", NULL);
-	oldpath = imapx_path_to_physical (storage_path, old);
-	newpath = imapx_path_to_physical (storage_path, new);
-	g_free (storage_path);
+		if (use_subscriptions)
+			success = imapx_subscribe_folder (
+				store, new, FALSE, cancellable, error);
+
+		storage_path = g_build_filename (user_cache_dir, "folders", NULL);
+		oldpath = imapx_path_to_physical (storage_path, old);
+		newpath = imapx_path_to_physical (storage_path, new);
+		g_free (storage_path);
+
+		/* So do we care if this didn't work?  Its just a cache? */
+		if (g_rename (oldpath, newpath) == -1) {
+			g_warning (
+				"Could not rename message cache '%s' to '%s': %s: cache reset",
+				oldpath, newpath, g_strerror (errno));
+		}
 
-	/* So do we care if this didn't work?  Its just a cache? */
-	if (g_rename (oldpath, newpath) == -1) {
-		g_warning (
-			"Could not rename message cache '%s' to '%s': %s: cache reset",
-			oldpath, newpath, g_strerror (errno));
+		g_free (oldpath);
+		g_free (newpath);
 	}
 
-	g_free (oldpath);
-	g_free (newpath);
+exit:
+	g_clear_object (&imapx_server);
 
 	return success;
 }
@@ -1778,25 +1779,21 @@ imapx_store_noop_sync (CamelStore *store
                        GCancellable *cancellable,
                        GError **error)
 {
-	CamelIMAPXStore *istore = (CamelIMAPXStore *) store;
-	GList *list, *link;
+	CamelIMAPXStore *imapx_store;
+	CamelIMAPXServer *imapx_server;
 	gboolean success = TRUE;
 
-	if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store)))
-		return TRUE;
+	/* If we're not connected then this truly is a no-op. */
 
-	list = camel_imapx_conn_manager_get_connections (istore->con_man);
+	imapx_store = CAMEL_IMAPX_STORE (store);
+	imapx_server = camel_imapx_store_ref_server (imapx_store, NULL);
 
-	for (link = list; link != NULL; link = g_list_next (link)) {
-		CamelIMAPXServer *server = CAMEL_IMAPX_SERVER (link->data);
-
-		/* we just return last noops value, technically not correct though */
-		success = camel_imapx_server_noop (server, NULL, cancellable, error);
-		if (!success)
-			break;
+	if (imapx_server != NULL) {
+		success = camel_imapx_server_noop (
+			imapx_server, NULL, cancellable, error);
 	}
 
-	g_list_free_full (list, (GDestroyNotify) g_object_unref);
+	g_clear_object (&imapx_server);
 
 	return success;
 }
@@ -2026,7 +2023,8 @@ camel_imapx_store_init (CamelIMAPXStore
 	g_mutex_init (&store->get_finfo_lock);
 	store->last_refresh_time = time (NULL) - (FINFO_REFRESH_INTERVAL + 10);
 	store->dir_sep = '/';
-	store->con_man = camel_imapx_conn_manager_new (CAMEL_STORE (store));
+
+	g_mutex_init (&store->priv->server_lock);
 
 	store->priv->quota_info = g_hash_table_new_full (
 		(GHashFunc) g_str_hash,
@@ -2042,6 +2040,50 @@ camel_imapx_store_init (CamelIMAPXStore
 		G_CALLBACK (imapx_store_update_store_flags), NULL);
 }
 
+/**
+ * camel_imapx_store_ref_server:
+ * @store: a #CamelIMAPXStore
+ * @error: return location for a #GError, or %NULL
+ *
+ * Returns the #CamelIMAPXServer for @store, if available.
+ *
+ * As a convenience, if the @store is not currently connected to an IMAP
+ * server, the function sets @error to %CAMEL_SERVER_ERROR_UNAVAILABLE and
+ * returns %NULL.  If an operation can possibly be executed while offline,
+ * pass %NULL for @error.
+ *
+ * The returned #CamelIMAPXServer is referenced for thread-safety and must
+ * be unreferenced with g_object_unref() when finished with it.
+ *
+ * Returns: a #CamelIMAPXServer, or %NULL
+ *
+ * Since: 3.10
+ **/
+CamelIMAPXServer *
+camel_imapx_store_ref_server (CamelIMAPXStore *store,
+                              GError **error)
+{
+	CamelIMAPXServer *server = NULL;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_STORE (store), NULL);
+
+	g_mutex_lock (&store->priv->server_lock);
+
+	if (store->priv->connected_server != NULL) {
+		server = g_object_ref (store->priv->connected_server);
+	} else {
+		g_set_error (
+			error, CAMEL_SERVICE_ERROR,
+			CAMEL_SERVICE_ERROR_UNAVAILABLE,
+			_("You must be working online "
+			"to complete this operation"));
+	}
+
+	g_mutex_unlock (&store->priv->server_lock);
+
+	return server;
+}
+
 CamelFolderQuotaInfo *
 camel_imapx_store_dup_quota_info (CamelIMAPXStore *store,
                                   const gchar *quota_root_name)
diff -up evolution-data-server-3.8.5/camel/camel-imapx-store.h.kill-imapx-conn-manager evolution-data-server-3.8.5/camel/camel-imapx-store.h
--- evolution-data-server-3.8.5/camel/camel-imapx-store.h.kill-imapx-conn-manager	2013-07-23 07:57:56.000000000 -0400
+++ evolution-data-server-3.8.5/camel/camel-imapx-store.h	2013-09-12 15:51:33.360412244 -0400
@@ -32,7 +32,6 @@
 
 #include "camel-imapx-server.h"
 #include "camel-imapx-store-summary.h"
-#include "camel-imapx-conn-manager.h"
 
 /* Standard GObject macros */
 #define CAMEL_TYPE_IMAPX_STORE \
@@ -63,9 +62,6 @@ struct _CamelIMAPXStore {
 	CamelOfflineStore parent;
 	CamelIMAPXStorePrivate *priv;
 
-	CamelIMAPXConnManager *con_man;
-	CamelIMAPXServer *authenticating_server;
-
 	CamelIMAPXStoreSummary *summary; /* in-memory list of folders */
 	gchar dir_sep;
 
@@ -91,13 +87,8 @@ struct _CamelIMAPXStoreClass {
 
 GType		camel_imapx_store_get_type	(void);
 CamelIMAPXServer *
-		camel_imapx_store_get_server	(CamelIMAPXStore *store,
-						 const gchar *folder_name,
-						 GCancellable *cancellable,
+		camel_imapx_store_ref_server	(CamelIMAPXStore *store,
 						 GError **error);
-void		camel_imapx_store_op_done	(CamelIMAPXStore *istore,
-						 CamelIMAPXServer *server,
-						 const gchar *folder_name);
 CamelFolderQuotaInfo *
 		camel_imapx_store_dup_quota_info
 						(CamelIMAPXStore *store,
diff -up evolution-data-server-3.8.5/camel/Makefile.am.kill-imapx-conn-manager evolution-data-server-3.8.5/camel/Makefile.am
--- evolution-data-server-3.8.5/camel/Makefile.am.kill-imapx-conn-manager	2013-04-18 11:33:59.000000000 -0400
+++ evolution-data-server-3.8.5/camel/Makefile.am	2013-09-12 15:51:33.270412271 -0400
@@ -180,7 +180,6 @@ libcamel_1_2_la_SOURCES = 			\
 	camel-vee-summary.c			\
 	camel-vtrash-folder.c			\
 	camel-imapx-command.c			\
-	camel-imapx-conn-manager.c		\
 	camel-imapx-folder.c			\
 	camel-imapx-job.c			\
 	camel-imapx-search.c			\
@@ -315,7 +314,6 @@ libcamelinclude_HEADERS =			\
 	camel-vee-summary.h			\
 	camel-vtrash-folder.h			\
 	camel-imapx-command.h			\
-	camel-imapx-conn-manager.h		\
 	camel-imapx-folder.h			\
 	camel-imapx-job.h			\
 	camel-imapx-search.h			\
diff -up evolution-data-server-3.8.5/docs/reference/camel/camel-docs.sgml.kill-imapx-conn-manager evolution-data-server-3.8.5/docs/reference/camel/camel-docs.sgml
--- evolution-data-server-3.8.5/docs/reference/camel/camel-docs.sgml.kill-imapx-conn-manager	2013-03-17 08:46:02.000000000 -0400
+++ evolution-data-server-3.8.5/docs/reference/camel/camel-docs.sgml	2013-09-12 15:51:33.397412234 -0400
@@ -202,7 +202,6 @@
     <chapter id="IMAP">
       <title>Extensible IMAP</title>
       <xi:include href="xml/camel-imapx-command.xml"/>
-      <xi:include href="xml/camel-imapx-conn-manager.xml"/>
       <xi:include href="xml/camel-imapx-folder.xml"/>
       <xi:include href="xml/camel-imapx-job.xml"/>
       <xi:include href="xml/camel-imapx-search.xml"/>
diff -up evolution-data-server-3.8.5/docs/reference/camel/camel-sections.txt.kill-imapx-conn-manager evolution-data-server-3.8.5/docs/reference/camel/camel-sections.txt
--- evolution-data-server-3.8.5/docs/reference/camel/camel-sections.txt.kill-imapx-conn-manager	2013-08-11 07:26:25.000000000 -0400
+++ evolution-data-server-3.8.5/docs/reference/camel/camel-sections.txt	2013-09-12 15:51:33.407412231 -0400
@@ -770,29 +770,6 @@ camel_imapx_command_queue_delete_link
 </SECTION>
 
 <SECTION>
-<FILE>camel-imapx-conn-manager</FILE>
-<TITLE>CamelIMAPXConnManager</TITLE>
-CamelIMAPXConnManager
-camel_imapx_conn_manager_new
-camel_imapx_conn_manager_ref_store
-camel_imapx_conn_manager_get_connection
-camel_imapx_conn_manager_close_connections
-camel_imapx_conn_manager_get_connections
-camel_imapx_conn_manager_update_con_info
-<SUBSECTION Standard>
-CAMEL_IMAPX_CONN_MANAGER
-CAMEL_IS_IMAPX_CONN_MANAGER
-CAMEL_TYPE_IMAPX_CONN_MANAGER
-CAMEL_IMAPX_CONN_MANAGER_CLASS
-CAMEL_IS_IMAPX_CONN_MANAGER_CLASS
-CAMEL_IMAPX_CONN_MANAGER_GET_CLASS
-CamelIMAPXConnManagerClass
-camel_imapx_conn_manager_get_type
-<SUBSECTION Private>
-CamelIMAPXConnManagerPrivate
-</SECTION>
-
-<SECTION>
 <FILE>camel-imapx-folder</FILE>
 <TITLE>CamelIMAPXFolder</TITLE>
 CamelIMAPXFolder
@@ -970,8 +947,7 @@ CamelIMAPXSettingsPrivate
 <FILE>camel-imapx-store</FILE>
 <TITLE>CamelIMAPXStore</TITLE>
 CamelIMAPXStore
-camel_imapx_store_get_server
-camel_imapx_store_op_done
+camel_imapx_store_ref_server
 camel_imapx_store_dup_quota_info
 camel_imapx_store_set_quota_info
 <SUBSECTION Standard>
diff -up evolution-data-server-3.8.5/docs/reference/camel/camel.types.kill-imapx-conn-manager evolution-data-server-3.8.5/docs/reference/camel/camel.types
--- evolution-data-server-3.8.5/docs/reference/camel/camel.types.kill-imapx-conn-manager	2013-08-11 07:26:25.000000000 -0400
+++ evolution-data-server-3.8.5/docs/reference/camel/camel.types	2013-09-12 15:51:33.417412228 -0400
@@ -16,7 +16,6 @@ camel_folder_search_get_type
 camel_folder_summary_get_type
 camel_gpg_context_get_type
 camel_html_parser_get_type
-camel_imapx_conn_manager_get_type
 camel_imapx_folder_get_type
 camel_imapx_search_get_type
 camel_imapx_server_get_type