Blob Blame History Raw
diff -up evolution-data-server-3.8.5/camel/camel-imapx-command.c.imapx-check-cancelled-jobs evolution-data-server-3.8.5/camel/camel-imapx-command.c
--- evolution-data-server-3.8.5/camel/camel-imapx-command.c.imapx-check-cancelled-jobs	2013-08-02 16:57:28.000000000 +0200
+++ evolution-data-server-3.8.5/camel/camel-imapx-command.c	2014-05-13 14:18:26.234981690 +0200
@@ -579,8 +579,11 @@ camel_imapx_command_done (CamelIMAPXComm
 
 gboolean
 camel_imapx_command_set_error_if_failed (CamelIMAPXCommand *ic,
+					 GCancellable *cancellable,
                                          GError **error)
 {
+	CamelIMAPXJob *job;
+
 	g_return_val_if_fail (CAMEL_IS_IMAPX_COMMAND (ic), FALSE);
 
 	if (ic->status != NULL && ic->status->result != IMAPX_OK) {
@@ -607,7 +610,11 @@ camel_imapx_command_set_error_if_failed
 		return TRUE;
 	}
 
-	return FALSE;
+	job = camel_imapx_command_get_job (ic);
+
+	return (job && camel_imapx_job_propagate_error (job, error)) ||
+		g_cancellable_set_error_if_cancelled (cancellable, error) ||
+		(job && g_cancellable_set_error_if_cancelled (camel_imapx_job_get_cancellable (job), error));
 }
 
 CamelIMAPXCommandQueue *
diff -up evolution-data-server-3.8.5/camel/camel-imapx-command.h.imapx-check-cancelled-jobs evolution-data-server-3.8.5/camel/camel-imapx-command.h
--- evolution-data-server-3.8.5/camel/camel-imapx-command.h.imapx-check-cancelled-jobs	2013-07-23 13:57:42.000000000 +0200
+++ evolution-data-server-3.8.5/camel/camel-imapx-command.h	2014-05-13 14:18:26.234981690 +0200
@@ -122,6 +122,7 @@ void		camel_imapx_command_wait	(CamelIMA
 void		camel_imapx_command_done	(CamelIMAPXCommand *ic);
 gboolean	camel_imapx_command_set_error_if_failed
 						(CamelIMAPXCommand *ic,
+						 GCancellable *cancellable,
 						 GError **error);
 
 /* These are simple GQueue wrappers for CamelIMAPXCommands.
diff -up evolution-data-server-3.8.5/camel/camel-imapx-server.c.imapx-check-cancelled-jobs evolution-data-server-3.8.5/camel/camel-imapx-server.c
--- evolution-data-server-3.8.5/camel/camel-imapx-server.c.imapx-check-cancelled-jobs	2014-05-13 14:18:26.230981690 +0200
+++ evolution-data-server-3.8.5/camel/camel-imapx-server.c	2014-05-13 14:18:26.235981690 +0200
@@ -3208,7 +3208,7 @@ imapx_command_run_sync (CamelIMAPXServer
 	if (cancel_id > 0)
 		g_cancellable_disconnect (cancellable, cancel_id);
 
-	if (camel_imapx_command_set_error_if_failed (ic, error))
+	if (camel_imapx_command_set_error_if_failed (ic, cancellable, error))
 		return FALSE;
 
 	return success;
@@ -3314,7 +3314,7 @@ imapx_command_idle_done (CamelIMAPXServe
 	job = camel_imapx_command_get_job (ic);
 	g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
 
-	if (camel_imapx_command_set_error_if_failed (ic, error)) {
+	if (camel_imapx_command_set_error_if_failed (ic, cancellable, error)) {
 		g_prefix_error (
 			error, "%s: ",
 			_("Error performing IDLE"));
@@ -3690,7 +3690,7 @@ imapx_command_select_done (CamelIMAPXSer
 	gboolean success = TRUE;
 	GError *local_error = NULL;
 
-	if (camel_imapx_command_set_error_if_failed (ic, &local_error)) {
+	if (camel_imapx_command_set_error_if_failed (ic, cancellable, &local_error)) {
 		GQueue failed = G_QUEUE_INIT;
 		GQueue trash = G_QUEUE_INIT;
 		CamelFolder *folder;
@@ -4596,7 +4596,7 @@ imapx_command_fetch_message_done (CamelI
 
 	job->commands--;
 
-	if (camel_imapx_command_set_error_if_failed (ic, error)) {
+	if (camel_imapx_command_set_error_if_failed (ic, cancellable, error)) {
 		g_prefix_error (
 			error, "%s: ",
 			_("Error fetching message"));
@@ -4814,7 +4814,7 @@ imapx_command_copy_messages_step_done (C
 	uids = data->uids;
 	i = data->index;
 
-	if (camel_imapx_command_set_error_if_failed (ic, error)) {
+	if (camel_imapx_command_set_error_if_failed (ic, cancellable, error)) {
 		g_prefix_error (
 			error, "%s: ",
 			_("Error copying messages"));
@@ -4983,7 +4983,7 @@ imapx_command_append_message_done (Camel
 	mi = camel_message_info_clone (data->info);
 	old_uid = g_strdup (data->info->uid);
 
-	if (camel_imapx_command_set_error_if_failed (ic, error)) {
+	if (camel_imapx_command_set_error_if_failed (ic, cancellable, error)) {
 		g_prefix_error (
 			error, "%s: ",
 			_("Error appending message"));
@@ -5182,7 +5182,7 @@ imapx_command_step_fetch_done (CamelIMAP
 	i = data->index;
 
 	//printf ("%s: Mobile mode: %d Fetch Count %d\n", camel_folder_get_display_name (folder), mobile_mode, batch_count);
-	if (camel_imapx_command_set_error_if_failed (ic, error)) {
+	if (camel_imapx_command_set_error_if_failed (ic, cancellable, error)) {
 		g_prefix_error (
 			error, "%s: ",
 			_("Error fetching message headers"));
@@ -5333,12 +5333,15 @@ imapx_job_scan_changes_done (CamelIMAPXS
 	mobile_mode = camel_imapx_settings_get_mobile_mode (settings);
 	g_object_unref (settings);
 
-	if (camel_imapx_command_set_error_if_failed (ic, error)) {
+	if (camel_imapx_command_set_error_if_failed (ic, cancellable, error)) {
 		g_prefix_error (
 			error, "%s: ",
 			_("Error retrieving message"));
 		success = FALSE;
 
+		/*if (!ic->status || ic->status->result == IMAPX_OK) {
+			printf ("%s: might do something when the job for '%s' was cancelled/ended with error, but did not\n", __FUNCTION__, camel_folder_get_full_name (folder));
+		}*/
 	} else {
 		GCompareDataFunc uid_cmp = imapx_uid_cmp;
 		CamelMessageInfo *s_minfo = NULL;
@@ -5581,7 +5584,7 @@ imapx_command_fetch_new_messages_done (C
 	ifolder = CAMEL_IMAPX_FOLDER (folder);
 	isum = CAMEL_IMAPX_SUMMARY (folder->summary);
 
-	if (camel_imapx_command_set_error_if_failed (ic, error)) {
+	if (camel_imapx_command_set_error_if_failed (ic, cancellable, error)) {
 		g_prefix_error (
 			error, "%s: ",
 			_("Error fetching new messages"));
@@ -6124,7 +6127,7 @@ imapx_command_expunge_done (CamelIMAPXSe
 	folder = camel_imapx_job_ref_folder (job);
 	g_return_val_if_fail (folder != NULL, FALSE);
 
-	if (camel_imapx_command_set_error_if_failed (ic, error)) {
+	if (camel_imapx_command_set_error_if_failed (ic, cancellable, error)) {
 		g_prefix_error (
 			error, "%s: ",
 			_("Error expunging message"));
@@ -6235,7 +6238,7 @@ imapx_command_list_done (CamelIMAPXServe
 	job = camel_imapx_command_get_job (ic);
 	g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
 
-	if (camel_imapx_command_set_error_if_failed (ic, error)) {
+	if (camel_imapx_command_set_error_if_failed (ic, cancellable, error)) {
 		g_prefix_error (
 			error, "%s: ",
 			_("Error fetching folders"));
@@ -6317,7 +6320,7 @@ imapx_command_subscription_done (CamelIM
 	job = camel_imapx_command_get_job (ic);
 	g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
 
-	if (camel_imapx_command_set_error_if_failed (ic, error)) {
+	if (camel_imapx_command_set_error_if_failed (ic, cancellable, error)) {
 		g_prefix_error (
 			error, "%s: ",
 			_("Error subscribing to folder"));
@@ -6382,7 +6385,7 @@ imapx_command_create_folder_done (CamelI
 	job = camel_imapx_command_get_job (ic);
 	g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
 
-	if (camel_imapx_command_set_error_if_failed (ic, error)) {
+	if (camel_imapx_command_set_error_if_failed (ic, cancellable, error)) {
 		g_prefix_error (
 			error, "%s: ",
 			_("Error creating folder"));
@@ -6436,7 +6439,7 @@ imapx_command_delete_folder_done (CamelI
 	job = camel_imapx_command_get_job (ic);
 	g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
 
-	if (camel_imapx_command_set_error_if_failed (ic, error)) {
+	if (camel_imapx_command_set_error_if_failed (ic, cancellable, error)) {
 		g_prefix_error (
 			error, "%s: ",
 			_("Error deleting folder"));
@@ -6510,7 +6513,7 @@ imapx_command_rename_folder_done (CamelI
 	job = camel_imapx_command_get_job (ic);
 	g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
 
-	if (camel_imapx_command_set_error_if_failed (ic, error)) {
+	if (camel_imapx_command_set_error_if_failed (ic, cancellable, error)) {
 		g_prefix_error (
 			error, "%s: ",
 			_("Error renaming folder"));
@@ -6585,7 +6588,7 @@ imapx_command_update_quota_info_done (Ca
 	job = camel_imapx_command_get_job (ic);
 	g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
 
-	if (camel_imapx_command_set_error_if_failed (ic, error)) {
+	if (camel_imapx_command_set_error_if_failed (ic, cancellable, error)) {
 		g_prefix_error (
 			error, "%s: ",
 			_("Error retrieving quota information"));
@@ -6652,7 +6655,7 @@ imapx_command_uid_search_done (CamelIMAP
 	data = camel_imapx_job_get_data (job);
 	g_return_val_if_fail (data != NULL, FALSE);
 
-	if (camel_imapx_command_set_error_if_failed (ic, error)) {
+	if (camel_imapx_command_set_error_if_failed (ic, cancellable, error)) {
 		g_prefix_error (error, "%s: ", _("Search failed"));
 		success = FALSE;
 	}
@@ -6713,7 +6716,7 @@ imapx_command_noop_done (CamelIMAPXServe
 	job = camel_imapx_command_get_job (ic);
 	g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
 
-	if (camel_imapx_command_set_error_if_failed (ic, error)) {
+	if (camel_imapx_command_set_error_if_failed (ic, cancellable, error)) {
 		g_prefix_error (
 			error, "%s: ",
 			_("Error performing NOOP"));
@@ -6822,7 +6825,7 @@ imapx_command_sync_changes_done (CamelIM
 	 * that what we just set is actually what is on the server now .. but
 	 * if it isn't, i guess we'll fix up next refresh */
 
-	if (camel_imapx_command_set_error_if_failed (ic, error)) {
+	if (camel_imapx_command_set_error_if_failed (ic, cancellable, error)) {
 		g_prefix_error (
 			error, "%s: ",
 			_("Error syncing changes"));