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



commit 01e5a25a6343aa608dc96d396086dc0dcccc5026
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 5b33ccd..612a009 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]