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



commit 4112a00e9940e71ce87e84d0bd83de7422fe9e6d
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.

 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 4b8dbb6..f79b333 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -142,6 +142,7 @@ enum {
 	IMAPX_DISCONNECTED,
 	IMAPX_CONNECTED,
 	IMAPX_AUTHENTICATED,
+	IMAPX_INITIALISED,
 	IMAPX_SELECTED
 };
 
@@ -1756,7 +1757,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);
@@ -2138,7 +2139,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;
@@ -2650,8 +2651,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);
@@ -4226,7 +4229,7 @@ camel_imapx_server_connect (CamelIMAPXServer *is, gboolean connect, CamelExcepti
 
 	camel_service_lock (CAMEL_SERVICE (is->store), CAMEL_SERVICE_REC_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]