[evolution-data-server] Bug 748636 - [IMAPx] Disable LIST-EXTENDED extension for Cyrus servers



commit e68fa19e880bc8990183fab38b74d9af79b3f75f
Author: Milan Crha <mcrha redhat com>
Date:   Thu Apr 30 17:37:09 2015 +0200

    Bug 748636 - [IMAPx] Disable LIST-EXTENDED extension for Cyrus servers

 camel/providers/imapx/camel-imapx-server.c |   17 +++++++++++++++++
 camel/providers/imapx/camel-imapx-utils.c  |    5 ++++-
 2 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 0c0e984..5a9856a 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -397,6 +397,8 @@ struct _CamelIMAPXServerPrivate {
        GHashTable *jobs_prop_folder_paths;
        gint jobs_prop_command_count; /* without IDLE command */
        gint jobs_prop_expensive_command_count;
+
+       gboolean is_cyrus;
 };
 
 enum {
@@ -3424,6 +3426,17 @@ imapx_completion (CamelIMAPXServer *is,
        if (ic->status == NULL)
                goto exit;
 
+       if (ic->status->condition == IMAPX_CAPABILITY) {
+               guint32 list_extended = imapx_lookup_capability ("LIST-EXTENDED");
+
+               is->priv->is_cyrus = is->priv->is_cyrus || (ic->status->text && camel_strstrcase 
(ic->status->text, "cyrus"));
+               if (is->priv->is_cyrus && ic->status->u.cinfo && (ic->status->u.cinfo->capa & list_extended) 
!= 0) {
+                       /* Disable LIST-EXTENDED for cyrus servers */
+                       c (is->tagprefix, "Disabling LIST-EXTENDED extension for a Cyrus server\n");
+                       ic->status->u.cinfo->capa &= ~list_extended;
+               }
+       }
+
        if (ic->complete != NULL)
                ic->complete (is, ic);
 
@@ -8167,6 +8180,7 @@ camel_imapx_server_init (CamelIMAPXServer *is)
        g_rec_mutex_init (&is->queue_lock);
 
        is->state = IMAPX_DISCONNECTED;
+       is->priv->is_cyrus = FALSE;
 
        is->priv->changes = camel_folder_change_info_new ();
 
@@ -8353,6 +8367,7 @@ imapx_disconnect (CamelIMAPXServer *is)
                is->cinfo = NULL;
        }
 
+       is->priv->is_cyrus = FALSE;
        is->state = IMAPX_DISCONNECTED;
 }
 
@@ -8375,6 +8390,8 @@ camel_imapx_server_connect (CamelIMAPXServer *is,
        if (is->state >= IMAPX_INITIALISED)
                return TRUE;
 
+       is->priv->is_cyrus = FALSE;
+
        if (!imapx_reconnect (is, cancellable, error))
                return FALSE;
 
diff --git a/camel/providers/imapx/camel-imapx-utils.c b/camel/providers/imapx/camel-imapx-utils.c
index 71679ed..9e39bdf 100644
--- a/camel/providers/imapx/camel-imapx-utils.c
+++ b/camel/providers/imapx/camel-imapx-utils.c
@@ -504,7 +504,7 @@ imapx_parse_capability (CamelIMAPXInputStream *stream,
                                /* Put it back so that imapx_untagged() isn't unhappy */
                                camel_imapx_input_stream_ungettoken (
                                        stream, tok, token, len);
-                               return cinfo;
+                               break;
                        case 43:
                                token = (guchar *) g_strconcat ((gchar *) token, "+", NULL);
                                free_token = TRUE;
@@ -536,6 +536,9 @@ imapx_parse_capability (CamelIMAPXInputStream *stream,
                                break;
                }
 
+               if (tok == ']')
+                       break;
+
                tok = camel_imapx_input_stream_token (
                        stream, &token, &len, cancellable, &local_error);
        }


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