Prioritize the entered IMAP folder delimiter.
authorBrendan Cully <brendan@kublai.com>
Sun, 11 Jan 2009 01:47:29 +0000 (17:47 -0800)
committerBrendan Cully <brendan@kublai.com>
Sun, 11 Jan 2009 01:47:29 +0000 (17:47 -0800)
First priority is the connection delimiter.
Second priority is the user's delimiter if it is in imap_delim_chars.
We no longer use the first character in imap_delim_chars.

imap/util.c

index 45e5673ba7af5ef54a10dc50123ffddfc70aa260..2a5899856f16199629ee8c9a8a568f4feac271e4 100644 (file)
@@ -393,19 +393,19 @@ char *imap_fix_path (IMAP_DATA *idata, char *mailbox, char *path,
     size_t plen)
 {
   int i = 0;
-  char delim;
+  char delim = '\0';
   
   if (idata)
     delim = idata->delim;
-  else if (ImapDelimChars && ImapDelimChars[0])
-    delim = ImapDelimChars[0];
-  else
-    delim = '/';
 
   while (mailbox && *mailbox && i < plen - 1)
   {
-    if (strchr(ImapDelimChars, *mailbox) || *mailbox == delim)
+    if (ImapDelimChars && strchr(ImapDelimChars, *mailbox) || *mailbox == delim)
     {
+      /* use connection delimiter if known. Otherwise use user delimiter */
+      if (!delim)
+        delim = *mailbox;
+
       while (*mailbox &&
             (strchr(ImapDelimChars, *mailbox) || *mailbox == delim))
         mailbox++;