[evolution-data-server/gnome-2-30] Do not set exception if its already set (cherry picked from commit 4bb7a0f078b122c9426408df04c9bb70f



commit 190ded547314850f26848c8714c40357fe3ac437
Author: Chenthill Palanisamy <pchenthill novell com>
Date:   Fri Jun 18 08:34:07 2010 +0530

    Do not set exception if its already set
    (cherry picked from commit 4bb7a0f078b122c9426408df04c9bb70f7c611aa)

 camel/providers/imapx/camel-imapx-folder.c |    3 ++-
 camel/providers/imapx/camel-imapx-server.c |   22 +++++++++++++---------
 2 files changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-folder.c b/camel/providers/imapx/camel-imapx-folder.c
index 3a102e0..75840f6 100644
--- a/camel/providers/imapx/camel-imapx-folder.c
+++ b/camel/providers/imapx/camel-imapx-folder.c
@@ -203,7 +203,8 @@ imapx_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
 		if (istore->server && camel_imapx_server_connect (istore->server, TRUE, ex)) {
 			stream = camel_imapx_server_get_message(istore->server, folder, uid, ex);
 		} else {
-			camel_exception_setv(ex, 1, "not authenticated");
+			if (!camel_exception_is_set (ex))
+				camel_exception_setv(ex, 1, "not authenticated");
 			return NULL;
 		}
 	}
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 9d2f93f..649d6a2 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -1653,7 +1653,7 @@ imapx_step(CamelIMAPXServer *is, CamelException *ex)
 /* Used to run 1 command synchronously,
    use for capa, login, and namespaces only. */
 static void
-imapx_command_run(CamelIMAPXServer *is, CamelIMAPXCommand *ic)
+imapx_command_run (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 /* throws IO,PARSE exception */
 {
 	camel_imapx_command_close(ic);
@@ -1662,9 +1662,9 @@ imapx_command_run(CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 	imapx_command_start(is, ic);
 	QUEUE_UNLOCK(is);
 
-	do {
+	while (ic->status == NULL && !camel_exception_is_set (ic->ex))
 		imapx_step(is, ic->ex);
-	} while (ic->status == NULL && !camel_exception_is_set (ic->ex));
+	
 	if (is->literal == ic)
 		is->literal = NULL;
 
@@ -2519,11 +2519,15 @@ imapx_reconnect (CamelIMAPXServer *is, CamelException *ex)
 		camel_imapx_command_free(ic);
 	}
 
+	if (camel_exception_is_set (ex))
+		goto exception;
+
 	/* After login we re-capa */
 	if (is->cinfo) {
 		imapx_free_capability(is->cinfo);
 		is->cinfo = NULL;
 	}
+	
 
 	ic = camel_imapx_command_new("CAPABILITY", NULL, "CAPABILITY");
 	imapx_command_run (is, ic);
@@ -3279,7 +3283,7 @@ imapx_job_refresh_info_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
 		camel_imapx_server_noop (is, folder, ex);
 
 		if (camel_exception_is_set (ex))
-			goto exception;
+			goto done;
 	}
 
 	/* Fetch the new messages */
@@ -3287,13 +3291,13 @@ imapx_job_refresh_info_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
 	{
 		imapx_server_fetch_new_messages (is, folder, FALSE, job->ex);
 		if (camel_exception_is_set (job->ex))
-			goto exception;
+			goto done;
 	}
 
 	/* Sync changes before fetching status, else unread count will not match. need to think about better ways for this */
 	imapx_server_sync_changes (is, folder, job->pri, ex);
 	if (camel_exception_is_set (job->ex))
-		goto exception;
+		goto done;
 
 	/* Check if a rescan is needed */
 	total = camel_folder_summary_count (folder->summary);
@@ -3314,19 +3318,19 @@ imapx_job_refresh_info_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
 				camel_exception_xfer (job->ex, ic->ex);
 
 			camel_imapx_command_free (ic);
-			goto exception;
+			goto done;
 		}
 		camel_imapx_command_free (ic);
 
 		camel_object_get (folder, NULL, CAMEL_FOLDER_UNREAD, &unread, NULL);
 		if (ifolder->exists_on_server == total && unread == ifolder->unread_on_server)
-			goto exception;
+			goto done;
 	}
 
 	imapx_job_scan_changes_start (is, job);
 	return;
 
-exception:
+done:
 	imapx_job_done (is, job);
 }
 



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