[evolution-data-server] CamelIMAPXServer: fixed API function for running custom commands



commit 47746fbc781cc624095bcde6130d271eeaacf88d
Author: Christian Hilberg <chilberg src gnome org>
Date:   Fri Jul 20 18:12:33 2012 +0200

    CamelIMAPXServer: fixed API function for running custom commands
    
    * imapx_command_run() deadlocks every now and then
      when running custom CamelIMAPXCommands
    * imapx_command_run_sync() does not, so we're using
      this one although it is definitely not the best
      possible solution
    * imapx_command_run_sync() expects a CamelIMAPXJob
      to be set on the CamelIMAPXCommand, so we're
      setting a local one if the command does not have
      a job set

 camel/camel-imapx-server.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/camel/camel-imapx-server.c b/camel/camel-imapx-server.c
index ddf921d..bd1a2a5 100644
--- a/camel/camel-imapx-server.c
+++ b/camel/camel-imapx-server.c
@@ -7060,10 +7060,26 @@ camel_imapx_server_command_run (CamelIMAPXServer *is,
                                 GCancellable *cancellable,
                                 GError **error)
 {
+	gboolean ok = FALSE;
+	CamelIMAPXJob *job = NULL;
+	gboolean local_job = FALSE;
+
 	g_return_val_if_fail (CAMEL_IS_IMAPX_SERVER (is), FALSE);
 	g_return_val_if_fail (CAMEL_IS_IMAPX_COMMAND (ic), FALSE);
 	/* cancellable may be NULL */
 	g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-	return imapx_command_run (is, ic, cancellable, error);
+	job = camel_imapx_command_get_job (ic);
+	if (job == NULL) {
+		job = camel_imapx_job_new (cancellable);
+		camel_imapx_command_set_job (ic, job);
+		local_job = TRUE;
+	}
+
+	ok = imapx_command_run_sync (is, ic, cancellable, error);
+
+	if (local_job)
+		camel_imapx_command_set_job (ic, NULL);
+
+	return ok;
 }



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