[evolution-data-server] [IMAPx] Select destination mailbox only when permanentflags not known yet



commit 6e302394c6f1b753c47e391c0d008426e8a1c850
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jan 16 07:51:04 2018 +0100

    [IMAPx] Select destination mailbox only when permanentflags not known yet
    
    The previous code meant that whenever a UID COPY/MOVE had been issued
    a SELECT to the destination folder and then (eventually back) to the source
    folder was done as well, even when it was not needed. Doing the destination
    folder SELECT only when needed speeds up message filtering by skipping
    unnecessary SELECT commands.

 src/camel/providers/imapx/camel-imapx-server.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/camel/providers/imapx/camel-imapx-server.c b/src/camel/providers/imapx/camel-imapx-server.c
index 2b71264..5937c8b 100644
--- a/src/camel/providers/imapx/camel-imapx-server.c
+++ b/src/camel/providers/imapx/camel-imapx-server.c
@@ -4306,9 +4306,11 @@ camel_imapx_server_copy_message_sync (CamelIMAPXServer *is,
        g_return_val_if_fail (CAMEL_IS_IMAPX_MAILBOX (destination), FALSE);
        g_return_val_if_fail (uids != NULL, FALSE);
 
-       /* To get permanent flags. That's okay if the "SELECT" fails here, as it can be
-          due to the folder being write-only; just ignore the error and continue. */
-       camel_imapx_server_ensure_selected_sync (is, destination, cancellable, NULL);
+       if (camel_imapx_mailbox_get_permanentflags (destination) == ~0) {
+               /* To get permanent flags. That's okay if the "SELECT" fails here, as it can be
+                  due to the folder being write-only; just ignore the error and continue. */
+               camel_imapx_server_ensure_selected_sync (is, destination, cancellable, NULL);
+       }
 
        if (g_cancellable_set_error_if_cancelled (cancellable, error))
                return FALSE;


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