[evolution-data-server] IMAPX: Support IMAP MOVE extension.



commit e2355e318a87f4512c789026f998598249ab030f
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed May 8 13:30:18 2013 -0400

    IMAPX: Support IMAP MOVE extension.
    
    http://tools.ietf.org/rfc/rfc6851

 camel/camel-imapx-server.c |   14 +++++++++++++-
 camel/camel-imapx-utils.c  |    3 ++-
 camel/camel-imapx-utils.h  |    3 ++-
 3 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/camel/camel-imapx-server.c b/camel/camel-imapx-server.c
index f56db52..cfc0446 100644
--- a/camel/camel-imapx-server.c
+++ b/camel/camel-imapx-server.c
@@ -142,6 +142,7 @@ struct _CopyMessagesData {
        CamelFolder *dest;
        GPtrArray *uids;
        gboolean delete_originals;
+       gboolean use_move_command;
        gint index;
        gint last_index;
        struct _uidset_state uidset;
@@ -4717,7 +4718,10 @@ imapx_command_copy_messages_step_start (CamelIMAPXServer *is,
 
        uids = data->uids;
 
-       ic = camel_imapx_command_new (is, "COPY", folder, "UID COPY ");
+       if (data->use_move_command)
+               ic = camel_imapx_command_new (is, "MOVE", folder, "UID MOVE ");
+       else
+               ic = camel_imapx_command_new (is, "COPY", folder, "UID COPY ");
        ic->complete = imapx_command_copy_messages_step_done;
        camel_imapx_command_set_job (ic, job);
        ic->pri = job->pri;
@@ -7563,6 +7567,14 @@ camel_imapx_server_copy_message (CamelIMAPXServer *is,
        data->uids = g_ptr_array_new ();
        data->delete_originals = delete_originals;
 
+       /* If we're moving messages, prefer "UID MOVE" if supported. */
+       if (data->delete_originals) {
+               if (CAMEL_IMAPX_HAVE_CAPABILITY (is->cinfo, MOVE)) {
+                       data->delete_originals = FALSE;
+                       data->use_move_command = TRUE;
+               }
+       }
+
        for (ii = 0; ii < uids->len; ii++)
                g_ptr_array_add (data->uids, g_strdup (uids->pdata[ii]));
 
diff --git a/camel/camel-imapx-utils.c b/camel/camel-imapx-utils.c
index fcf2f5a..44518e5 100644
--- a/camel/camel-imapx-utils.c
+++ b/camel/camel-imapx-utils.c
@@ -373,7 +373,8 @@ struct {
        { "QRESYNC", IMAPX_CAPABILITY_QRESYNC },
        { "LIST-EXTENDED", IMAPX_CAPABILITY_LIST_EXTENDED },
        { "LIST-STATUS", IMAPX_CAPABILITY_LIST_STATUS },
-       { "QUOTA", IMAPX_CAPABILITY_QUOTA }
+       { "QUOTA", IMAPX_CAPABILITY_QUOTA },
+       { "MOVE", IMAPX_CAPABILITY_MOVE }
 };
 
 static GMutex capa_htable_lock;         /* capabilities lookup table lock */
diff --git a/camel/camel-imapx-utils.h b/camel/camel-imapx-utils.h
index b83e0ad..91e8964 100644
--- a/camel/camel-imapx-utils.h
+++ b/camel/camel-imapx-utils.h
@@ -177,7 +177,8 @@ enum {
        IMAPX_CAPABILITY_QRESYNC                = (1 << 9),
        IMAPX_CAPABILITY_LIST_STATUS            = (1 << 10),
        IMAPX_CAPABILITY_LIST_EXTENDED          = (1 << 11),
-       IMAPX_CAPABILITY_QUOTA                  = (1 << 12)
+       IMAPX_CAPABILITY_QUOTA                  = (1 << 12),
+       IMAPX_CAPABILITY_MOVE                   = (1 << 13)
 };
 
 struct _capability_info {


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