Blame SOURCES/evolution-data-server-3.8.5-imapx-check-cancelled-jobs.patch

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