From 35bb85fdf67039394e1dc20ac7d09fdaaa805c54 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 7 Aug 2000 20:32:27 +0000 Subject: If we are trying to get a subfolder listing of the root folder, always 2000-08-07 Jeffrey Stedfast * providers/imap/camel-imap-folder.c (imap_get_subfolder_names_internal): If we are trying to get a subfolder listing of the root folder, always make sure INBOX is there... * providers/imap/camel-imap-utils.c (imap_parse_list_response): Check for NIL as a directory separator. svn path=/trunk/; revision=4582 --- camel/ChangeLog | 10 ++++++++++ camel/providers/imap/camel-imap-folder.c | 23 ++++++++++++++++------- camel/providers/imap/camel-imap-utils.c | 10 +++++++--- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index 035ee3651e..63ee2758fd 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,13 @@ +2000-08-07 Jeffrey Stedfast + + * providers/imap/camel-imap-folder.c + (imap_get_subfolder_names_internal): If we are trying to get a + subfolder listing of the root folder, always make sure INBOX is + there... + + * providers/imap/camel-imap-utils.c (imap_parse_list_response): + Check for NIL as a directory separator. + 2000-08-07 Jeffrey Stedfast * providers/imap/camel-imap-utils.c (imap_translate_sexp): Strip diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index ca99da671c..82d133b0ab 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -734,6 +734,7 @@ imap_get_subfolder_names_internal (CamelFolder *folder, CamelException *ex) CamelStore *store = CAMEL_STORE (folder->parent_store); CamelURL *url = CAMEL_SERVICE (store)->url; GPtrArray *listing; + gboolean found_inbox = FALSE; gint status; gchar *result, *namespace, *dir_sep; @@ -776,17 +777,17 @@ imap_get_subfolder_names_internal (CamelFolder *folder, CamelException *ex) char *ptr = result; while (ptr && *ptr == '*') { - gchar *flags, *sep, *folder, *buf, *end; + gchar *flags, *sep, *dir, *buf, *end; for (end = ptr; *end && *end != '\n'; end++); buf = g_strndup (ptr, (gint)(end - ptr)); ptr = end; - if (!imap_parse_list_response (buf, namespace, &flags, &sep, &folder)) { + if (!imap_parse_list_response (buf, namespace, &flags, &sep, &dir)) { g_free (buf); g_free (flags); g_free (sep); - g_free (folder); + g_free (dir); if (*ptr == '\n') ptr++; @@ -797,9 +798,12 @@ imap_get_subfolder_names_internal (CamelFolder *folder, CamelException *ex) g_free (buf); g_free (flags); - d(fprintf (stderr, "adding folder: %s\n", folder)); - - g_ptr_array_add (listing, folder); + if (*dir) { + d(fprintf (stderr, "adding folder: %s\n", dir)); + if (!strcmp (dir, "INBOX")) + found_inbox = TRUE; + g_ptr_array_add (listing, dir); + } g_free (sep); @@ -807,9 +811,14 @@ imap_get_subfolder_names_internal (CamelFolder *folder, CamelException *ex) ptr++; } } + + if (!strcmp (folder->name, namespace) && !found_inbox) { + g_ptr_array_add (listing, "INBOX"); + } + g_free (result); g_free (namespace); - + imap_folder->lsub = listing; return listing; diff --git a/camel/providers/imap/camel-imap-utils.c b/camel/providers/imap/camel-imap-utils.c index f1c4c17782..3378758a69 100644 --- a/camel/providers/imap/camel-imap-utils.c +++ b/camel/providers/imap/camel-imap-utils.c @@ -94,9 +94,13 @@ imap_parse_list_response (char *buf, char *namespace, char **flags, char **sep, /* get the directory separator */ word = imap_next_word (ep); if (*word) { - for (ep = word; *ep && *ep != ' '; ep++); - *sep = g_strndup (word, (gint)(ep - word)); - string_unquote (*sep); + if (!strncmp (word, "NIL", 3)) { + *sep = NULL; + } else { + for (ep = word; *ep && *ep != ' '; ep++); + *sep = g_strndup (word, (gint)(ep - word)); + string_unquote (*sep); + } } else { return FALSE; } -- cgit v1.2.3