diff options
-rw-r--r-- | camel/ChangeLog | 8 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 31 |
2 files changed, 27 insertions, 12 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index a13109fe80..3a2563fefc 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,11 @@ +2000-12-22 Dan Winship <danw@helixcode.com> + + * providers/imap/camel-imap-store.c (get_folder_info): When + getting the top-level folder list, include INBOX even if it's not + subscribed. Don't show subscribed folders outside of the given + namespace. Do a better job of pruning the namespace from the + returned folder tree. + 2000-12-21 Dan Winship <danw@helixcode.com> * providers/imap/camel-imap-search.c: New CamelFolderSearch diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 6a87aec3ad..e3bd61af27 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -615,7 +615,7 @@ get_folder_info (CamelStore *store, const char *top, gboolean fast, name = top; if (!name) { - need_inbox = !subscribed_only; + need_inbox = TRUE; if (url->path) name = url->path + 1; else @@ -636,9 +636,7 @@ get_folder_info (CamelStore *store, const char *top, gboolean fast, topfi->name = g_strdup (name); } - if (!top && subscribed_only) - pattern = g_strdup (recursive ? "*" : "%"); - else if (*name) + if (*name) pattern = g_strdup_printf ("%s%c%c", name, imap_store->dir_sep, recursive ? '*' : '%'); else @@ -721,14 +719,23 @@ get_folder_info (CamelStore *store, const char *top, gboolean fast, camel_folder_info_build (folders, topfi, imap_store->dir_sep, TRUE); g_ptr_array_free (folders, TRUE); - /* Remove the top if it's the root of the store. */ - if (!top && !topfi->sibling && !topfi->url) { - fi = topfi; - topfi = topfi->child; - fi->child = NULL; - camel_folder_info_free (fi); - for (fi = topfi; fi; fi = fi->sibling) - fi->parent = NULL; + /* If this is the root of the store, prune off any namespace. */ + if (!top && !topfi->sibling) { + int toplen = strlen (name), len; + + while (!topfi->sibling) { + len = strlen (topfi->full_name); + if (len > toplen || + strncmp (topfi->full_name, name, len) != 0) + break; + + fi = topfi; + topfi = topfi->child; + fi->child = NULL; + camel_folder_info_free (fi); + for (fi = topfi; fi; fi = fi->sibling) + fi->parent = NULL; + } } return topfi; |