[evolution-data-server] I#40 - [IMAPx] Support RFC 6855 (IMAP Support for UTF-8)



commit 56bfdfb224ac9b6ce1a410ce569a97a8a2dbf40b
Author: Milan Crha <mcrha redhat com>
Date:   Fri Oct 5 08:01:13 2018 +0200

    I#40 - [IMAPx] Support RFC 6855 (IMAP Support for UTF-8)
    
    Closes https://gitlab.gnome.org/GNOME/evolution-data-server/issues/40

 src/camel/providers/imapx/camel-imapx-server.c | 20 ++++++++++++++++++++
 src/camel/providers/imapx/camel-imapx-utils.c  |  4 +++-
 src/camel/providers/imapx/camel-imapx-utils.h  |  5 +++--
 3 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/src/camel/providers/imapx/camel-imapx-server.c b/src/camel/providers/imapx/camel-imapx-server.c
index f006a9681..cc82d1e5a 100644
--- a/src/camel/providers/imapx/camel-imapx-server.c
+++ b/src/camel/providers/imapx/camel-imapx-server.c
@@ -3338,6 +3338,26 @@ imapx_reconnect (CamelIMAPXServer *is,
 preauthed:
        /* Fetch namespaces (if supported). */
        g_mutex_lock (&is->priv->stream_lock);
+
+       /* RFC 6855 */
+       if (CAMEL_IMAPX_HAVE_CAPABILITY (is->priv->cinfo, UTF8_ACCEPT) ||
+           CAMEL_IMAPX_HAVE_CAPABILITY (is->priv->cinfo, UTF8_ONLY)) {
+               GError *local_error = NULL;
+
+               g_mutex_unlock (&is->priv->stream_lock);
+
+               ic = camel_imapx_command_new (is, CAMEL_IMAPX_JOB_NAMESPACE, "ENABLE UTF8=ACCEPT");
+               camel_imapx_server_process_command_sync (is, ic, _("Failed to issue ENABLE UTF8=ACCEPT"), 
cancellable, &local_error);
+               camel_imapx_command_unref (ic);
+
+               if (local_error != NULL) {
+                       g_propagate_error (error, local_error);
+                       goto exception;
+               }
+
+               g_mutex_lock (&is->priv->stream_lock);
+       }
+
        if (CAMEL_IMAPX_HAVE_CAPABILITY (is->priv->cinfo, NAMESPACE)) {
                GError *local_error = NULL;
 
diff --git a/src/camel/providers/imapx/camel-imapx-utils.c b/src/camel/providers/imapx/camel-imapx-utils.c
index b079ee153..a8d608f53 100644
--- a/src/camel/providers/imapx/camel-imapx-utils.c
+++ b/src/camel/providers/imapx/camel-imapx-utils.c
@@ -480,7 +480,9 @@ struct {
        { "MOVE", IMAPX_CAPABILITY_MOVE },
        { "NOTIFY", IMAPX_CAPABILITY_NOTIFY },
        { "SPECIAL-USE", IMAPX_CAPABILITY_SPECIAL_USE },
-       { "X-GM-EXT-1", IMAPX_CAPABILITY_X_GM_EXT_1 }
+       { "X-GM-EXT-1", IMAPX_CAPABILITY_X_GM_EXT_1 },
+       { "UTF8=ACCEPT", IMAPX_CAPABILITY_UTF8_ACCEPT },
+       { "UTF8=ONLY", IMAPX_CAPABILITY_UTF8_ONLY },
 };
 
 static GMutex capa_htable_lock;         /* capabilities lookup table lock */
diff --git a/src/camel/providers/imapx/camel-imapx-utils.h b/src/camel/providers/imapx/camel-imapx-utils.h
index 89c301934..202b40e7e 100644
--- a/src/camel/providers/imapx/camel-imapx-utils.h
+++ b/src/camel/providers/imapx/camel-imapx-utils.h
@@ -189,8 +189,9 @@ enum {
        IMAPX_CAPABILITY_MOVE = (1 << 13),
        IMAPX_CAPABILITY_NOTIFY = (1 << 14),
        IMAPX_CAPABILITY_SPECIAL_USE = (1 << 15),
-       IMAPX_CAPABILITY_X_GM_EXT_1 = (1 << 16)
-
+       IMAPX_CAPABILITY_X_GM_EXT_1 = (1 << 16),
+       IMAPX_CAPABILITY_UTF8_ACCEPT = (1 << 17),
+       IMAPX_CAPABILITY_UTF8_ONLY = (1 << 18)
 };
 
 struct _capability_info {


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