[evolution-data-server] Bug 738184 - [IMAPx] Not every server returns empty namespace prefix for INBOX



commit 57eb43b36ae087699f2512931308b9b4cf1d3dd4
Author: Milan Crha <mcrha redhat com>
Date:   Thu Oct 23 16:51:07 2014 +0200

    Bug 738184 - [IMAPx] Not every server returns empty namespace prefix for INBOX

 .../imapx/camel-imapx-namespace-response.c         |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-namespace-response.c 
b/camel/providers/imapx/camel-imapx-namespace-response.c
index ee933d6..057946d 100644
--- a/camel/providers/imapx/camel-imapx-namespace-response.c
+++ b/camel/providers/imapx/camel-imapx-namespace-response.c
@@ -500,7 +500,10 @@ camel_imapx_namespace_response_lookup_for_path (CamelIMAPXNamespaceResponse *res
 
                /* Special handling when searching for an empty prefix. */
                if (find_empty_prefix) {
-                       if (*prefix == '\0') {
+                       if (*prefix == '\0' ||
+                           g_ascii_strcasecmp (prefix, "INBOX") == 0 ||
+                           (g_ascii_strncasecmp (prefix, "INBOX", 5) == 0 &&
+                            prefix[5] == separator && !prefix[6])) {
                                g_queue_push_tail (&candidates, namespace);
                                break;
                        }
@@ -523,6 +526,11 @@ camel_imapx_namespace_response_lookup_for_path (CamelIMAPXNamespaceResponse *res
 
        /* First candidate is the preferred namespace. */
        match = g_queue_pop_head (&candidates);
+
+       /* Fallback to the first known namespace when none suitable for the given path found */
+       if (!match && head && head->data)
+               match = head->data;
+
        if (match != NULL)
                g_object_ref (match);
 


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