From 56ddb4490bb634e033c3efc1bc20170d2edfcc95 Mon Sep 17 00:00:00 2001 From: Peter Williams Date: Fri, 9 Aug 2002 19:37:31 +0000 Subject: Tweak how we build the tree based on whether a full tree or a subtree is 2002-08-09 Peter Williams * providers/imap/camel-imap-store.c (get_folder_info_online): Tweak how we build the tree based on whether a full tree or a subtree is being requested. Fixes subscribe dialog on UW servers. (get_one_folder_offline): Don't add folders that we're not subscribed to; fixes UW folders that weren't being marked as NoSelect because the storeinfo doesn't record that information. svn path=/trunk/; revision=17755 --- camel/providers/imap/camel-imap-store.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'camel/providers') diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index aa423dc711..7373df146b 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -2098,7 +2098,18 @@ get_folder_info_online (CamelStore *store, const char *top, } /* Assemble. */ - tree = camel_folder_info_build (folders, name, imap_store->dir_sep, TRUE); + + /* if building the folder tree, preserve the namespace at the top. Note the + * ==, not strcmp. This makes it so that the subscribe dialog and the folder + * tree have the same layout and prevents the subscribe dialog from building + * infinitely large trees. + */ + + if (name == imap_store->namespace) + tree = camel_folder_info_build (folders, "", imap_store->dir_sep, TRUE); + else + tree = camel_folder_info_build (folders, name, imap_store->dir_sep, TRUE); + if (flags & CAMEL_STORE_FOLDER_INFO_FAST) { g_ptr_array_free (folders, TRUE); return tree; @@ -2167,6 +2178,15 @@ get_one_folder_offline (const char *physical_path, const char *path, gpointer da if (*path != '/') return TRUE; + /* folder_info_build will insert parent nodes as necessary and mark + * them as noselect, which is information we actually don't have at + * the moment. So let it do the right thing by bailing out if it's + * not a folder we're explicitly interested in. + */ + + if (g_hash_table_lookup (imap_store->subscribed_folders, path + 1) == 0) + return TRUE; + fi = g_new0 (CamelFolderInfo, 1); fi->full_name = g_strdup (path+1); fi->name = strrchr (fi->full_name, imap_store->dir_sep); -- cgit v1.2.3