[evolution-data-server/gnome-2-30] Add IMAPX_INITIALISED state; don't let users run before CAPABILITY/NAMESPACE



commit 3c8793dd6f9ae34bccfbb71a7d46dc353d04dc1e
Author: David Woodhouse <David Woodhouse intel com>
Date:   Tue Jun 22 11:55:09 2010 +0100

    Add IMAPX_INITIALISED state; don't let users run before CAPABILITY/NAMESPACE
    
    Previously, other users would blindly carry on as soon as we reached the
    IMAPX_AUTHENTICATED state... and then occasionally fail because ->capa
    wasn't set, etc.
    (cherry picked from commit 4112a00e9940e71ce87e84d0bd83de7422fe9e6d)

 camel/providers/imapx/camel-imapx-server.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index e4ed21d..e11ac48 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -164,6 +164,7 @@ enum {
 	IMAPX_DISCONNECTED,
 	IMAPX_CONNECTED,
 	IMAPX_AUTHENTICATED,
+	IMAPX_INITIALISED,
 	IMAPX_SELECTED
 };
 
@@ -1752,7 +1753,7 @@ imapx_job_done (CamelIMAPXServer *is, CamelIMAPXJob *job)
 static gboolean
 imapx_register_job (CamelIMAPXServer *is, CamelIMAPXJob *job)
 {
-	if (is->state >= IMAPX_AUTHENTICATED) {
+	if (is->state >= IMAPX_INITIALISED) {
 		QUEUE_LOCK (is);
 		camel_dlist_addhead (&is->jobs, (CamelDListNode *)job);
 		QUEUE_UNLOCK (is);
@@ -2124,7 +2125,7 @@ imapx_select (CamelIMAPXServer *is, CamelFolder *folder, gboolean forced, CamelE
 	is->mode = 0;
 
 	/* Hrm, what about reconnecting? */
-	is->state = IMAPX_AUTHENTICATED;
+	is->state = IMAPX_INITIALISED;
 
 	ic = camel_imapx_command_new("SELECT", NULL, "SELECT %f", folder);
 	ic->complete = imapx_command_select_done;
@@ -2627,8 +2628,10 @@ imapx_reconnect (CamelIMAPXServer *is, CamelException *ex)
 		imapx_store->dir_sep = ns->sep;
 	}
 
-	if (!camel_exception_is_set (ex))
+	if (!camel_exception_is_set (ex)) {
+		is->state = IMAPX_INITIALISED;
 		return;
+	}
 
 exception:
 	imapx_disconnect (is);
@@ -4158,7 +4161,7 @@ camel_imapx_server_connect (CamelIMAPXServer *is, gboolean connect, CamelExcepti
 
 	CAMEL_SERVICE_REC_LOCK (is->store, connect_lock);
 	if (connect) {
-		if (is->state == IMAPX_AUTHENTICATED || is->state == IMAPX_SELECTED) {
+		if (is->state >= IMAPX_INITIALISED) {
 			ret = TRUE;
 			goto exit;
 		}



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