Skipped 2 existing revision(s) on branch 'master'.

commit 062706fcbf39bcee536ea4b5c690e2f30e122faa
Merge: fc300fd e4eac03
Author: Oswald Buddenhagen <o...@users.sf.net>
Date:   Wed Feb 3 15:53:05 2021 +0100

    Merge branch '1.3'
    
    Conflicts:
            configure.ac
            src/drv_imap.c

 src/drv_imap.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --cc src/drv_imap.c
index 8d7c99b,810479e..9f23e08
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@@ -1381,14 -1266,16 +1381,15 @@@ parse_list_rsp_p2( imap_store_t *ctx, l
                return LIST_BAD;
        }
        arg = list->val;
 -      argl = list->len;
 +      argl = (int)list->len;
-       if (is_inbox( ctx, arg, argl )) {
-               // The server might be weird and have a non-uppercase INBOX. It
-               // may legitimately do so, but we need the canonical spelling.
-               memcpy( arg, "INBOX", 5 );
-       } else if ((l = strlen( ctx->prefix ))) {
-               if (!starts_with( arg, argl, ctx->prefix, l ))
+       if ((l = strlen( ctx->prefix ))) {
+               if (!starts_with( arg, argl, ctx->prefix, l )) {
+                       if (is_inbox( ctx, arg, argl )) {
+                               // INBOX and its subfolders bypass the 
namespace.
+                               goto inbox;
+                       }
 -                      goto skip;
 +                      return LIST_OK;
+               }
                arg += l;
                argl -= l;
                // A folder named "INBOX" would be indistinguishable from the
@@@ -1398,14 -1285,22 +1399,22 @@@
                if (is_INBOX( ctx, arg, argl )) {
                        if (!arg[5])  // No need to complain about subfolders 
as well.
                                warn( "IMAP warning: ignoring INBOX in %s\n", 
ctx->prefix );
 -                      goto skip;
 +                      return LIST_OK;
                }
+       } else if (is_inbox( ctx, arg, argl )) {
+         inbox:
+               // The server might be weird and have a non-uppercase INBOX. It
+               // may legitimately do so, but we need the canonical spelling.
+               // Note that we do that only after prefix matching, under the
+               // assumption that the NAMESPACE (or Path) matches the
+               // capitalization of LIST.
+               memcpy( arg, "INBOX", 5 );
        }
        if (argl >= 5 && !memcmp( arg + argl - 5, ".lock", 5 )) /* workaround 
broken servers */
 -              goto skip;
 +              return LIST_OK;
        if (map_name( arg, (char **)&narg, offsetof(string_list_t, string), 
ctx->delimiter, "/") < 0) {
                warn( "IMAP warning: ignoring mailbox %s (reserved character 
'/' in name)\n", arg );
 -              goto skip;
 +              return LIST_OK;
        }
        narg->next = ctx->boxes;
        ctx->boxes = narg;

===== Full diff against 1st parent =====

diff --git a/src/drv_imap.c b/src/drv_imap.c
index 8d7c99b..9f23e08 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -1382,13 +1382,14 @@ parse_list_rsp_p2( imap_store_t *ctx, list_t *list, 
char *cmd ATTR_UNUSED )
        }
        arg = list->val;
        argl = (int)list->len;
-       if (is_inbox( ctx, arg, argl )) {
-               // The server might be weird and have a non-uppercase INBOX. It
-               // may legitimately do so, but we need the canonical spelling.
-               memcpy( arg, "INBOX", 5 );
-       } else if ((l = strlen( ctx->prefix ))) {
-               if (!starts_with( arg, argl, ctx->prefix, l ))
+       if ((l = strlen( ctx->prefix ))) {
+               if (!starts_with( arg, argl, ctx->prefix, l )) {
+                       if (is_inbox( ctx, arg, argl )) {
+                               // INBOX and its subfolders bypass the 
namespace.
+                               goto inbox;
+                       }
                        return LIST_OK;
+               }
                arg += l;
                argl -= l;
                // A folder named "INBOX" would be indistinguishable from the
@@ -1400,6 +1401,14 @@ parse_list_rsp_p2( imap_store_t *ctx, list_t *list, char 
*cmd ATTR_UNUSED )
                                warn( "IMAP warning: ignoring INBOX in %s\n", 
ctx->prefix );
                        return LIST_OK;
                }
+       } else if (is_inbox( ctx, arg, argl )) {
+         inbox:
+               // The server might be weird and have a non-uppercase INBOX. It
+               // may legitimately do so, but we need the canonical spelling.
+               // Note that we do that only after prefix matching, under the
+               // assumption that the NAMESPACE (or Path) matches the
+               // capitalization of LIST.
+               memcpy( arg, "INBOX", 5 );
        }
        if (argl >= 5 && !memcmp( arg + argl - 5, ".lock", 5 )) /* workaround 
broken servers */
                return LIST_OK;


_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to