diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-05-08 13:30:18 -0400 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-05-08 13:40:06 -0400 |
commit | 400c2dac2d113a4188c9823a6b805b85ea0c7840 (patch) | |
tree | ef65498c57a4f089dde5fb6bfe0be90f38715b98 | |
parent | cff0347cdd749e9a0f6f874fc02674b73439180c (diff) | |
download | evolution-data-server-400c2dac2d113a4188c9823a6b805b85ea0c7840.tar.gz |
IMAPX: Support IMAP MOVE extension.
http://tools.ietf.org/rfc/rfc6851
(cherry picked from commit e2355e318a87f4512c789026f998598249ab030f)
-rw-r--r-- | camel/camel-imapx-server.c | 14 | ||||
-rw-r--r-- | camel/camel-imapx-utils.c | 3 | ||||
-rw-r--r-- | 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 c5a79dd4f..eb741a7b8 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; @@ -7565,6 +7569,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 fcf2f5adb..44518e5e7 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 b83e0ad23..91e89643e 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 { |