diff options
author | Not Zed <NotZed@Ximian.com> | 2002-10-24 22:01:53 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2002-10-24 22:01:53 +0800 |
commit | d91b5bb03431dc5477cacfd2b922a68a1ec623c5 (patch) | |
tree | a8f5b77e2df75140c78e1bf811f50ed9ec9a888b /camel/camel-store.c | |
parent | 5f737e09fe3132cee4322b52332fc83add921d99 (diff) | |
download | gsoc2013-evolution-d91b5bb03431dc5477cacfd2b922a68a1ec623c5.tar.gz gsoc2013-evolution-d91b5bb03431dc5477cacfd2b922a68a1ec623c5.tar.zst gsoc2013-evolution-d91b5bb03431dc5477cacfd2b922a68a1ec623c5.zip |
** For bug #31647 and bug #31456.
2002-10-24 Not Zed <NotZed@Ximian.com>
** For bug #31647 and bug #31456.
* camel-store-summary.c (store_info_string): for STORE_INFO_NAME,
skip the leading /.
* providers/imap/camel-imap-store.c
(parse_list_response_as_folder_info): Remove jeff's last patch,
and use the store summary to create the name and path of the
folderinfo so it manages namespace issues.
(get_folder_info_online): Just pass @top directly to
build_folder_info always, since namespace is mapped to 1 tree
level.
(imap_build_folder_info): Remove jeff's last patch, dont strip
leading /'s, they shouldn't exist.
(imap_connect_online): Remove adding the INBOX here, we add it
later.
(get_subscribed_folders): Make sure INBOX is always in the list.
some imap servers dont seem to let you subscribe to it(?), so
always have it act as subscribed.
* camel-store.c (camel_folder_info_build): back out the last 2
patches from Jeff (for #31456) to get the original behaviour.
(camel_folder_info_build): When creating a fake
parent, dont strip the namespace from the full_name. malloc keys
in hash since we dont have them anymore.
(free_name): Helper to free names.
* providers/imap/camel-imap-store-summary.c
(camel_imap_store_summary_namespace_new): Canonicalise the
namespace (strip trailing dir_sep), and change the path to remove
any /'s.
(camel_imap_store_summary_namespace_find_path):
(camel_imap_store_summary_namespace_find_full): new, find
namespace by path/full name.
(camel_imap_store_summary_full_from_path): Changed to a simple
wrapper around path_to_full, after checking namespace.
(camel_imap_store_summary_add_from_full): map the namespace if
present.
(camel_imap_store_summary_path_to_full): If namespace exists,
unmap it.
svn path=/trunk/; revision=18424
Diffstat (limited to 'camel/camel-store.c')
-rw-r--r-- | camel/camel-store.c | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/camel/camel-store.c b/camel/camel-store.c index 43528a8353..d76af40e60 100644 --- a/camel/camel-store.c +++ b/camel/camel-store.c @@ -843,6 +843,12 @@ folder_info_cmp (const void *ap, const void *bp) return strcmp (a->full_name, b->full_name); } +static void +free_name(void *key, void *data, void *user) +{ + g_free(key); +} + /** * camel_folder_info_build: * @folders: an array of CamelFolderInfo @@ -873,25 +879,36 @@ camel_folder_info_build (GPtrArray *folders, const char *namespace, if (!namespace) namespace = ""; nlen = strlen (namespace); - + qsort (folders->pdata, folders->len, sizeof (folders->pdata[0]), folder_info_cmp); /* Hash the folders. */ hash = g_hash_table_new (g_str_hash, g_str_equal); for (i = 0; i < folders->len; i++) { fi = folders->pdata[i]; - g_hash_table_insert (hash, fi->full_name, fi); + if (!strncmp (namespace, fi->full_name, nlen)) + name = fi->full_name + nlen; + else + name = fi->full_name; + if (*name == separator) + name++; + g_hash_table_insert (hash, g_strdup(name), fi); } /* Now find parents. */ for (i = 0; i < folders->len; i++) { fi = folders->pdata[i]; - name = fi->full_name; - + if (!strncmp (namespace, fi->full_name, nlen)) + name = fi->full_name + nlen; + else + name = fi->full_name; + if (*name == separator) + name++; + /* set the path if it isn't already set */ if (!fi->path) camel_folder_info_build_path (fi, separator); - + p = strrchr (name, separator); if (p) { pname = g_strndup (name, p - name); @@ -903,9 +920,8 @@ camel_folder_info_build (GPtrArray *folders, const char *namespace, create a fake folder node */ CamelURL *url; char *sep; - + pfi = g_new0 (CamelFolderInfo, 1); - pfi->full_name = pname; if (short_names) { pfi->name = strrchr (pname, separator); if (pfi->name) @@ -914,7 +930,8 @@ camel_folder_info_build (GPtrArray *folders, const char *namespace, pfi->name = g_strdup (pname); } else pfi->name = g_strdup (pname); - + + /* FIXME: url's with fragments should have the fragment truncated, not path */ url = camel_url_new (fi->url, NULL); sep = strrchr (url->path, separator); if (sep) @@ -922,11 +939,13 @@ camel_folder_info_build (GPtrArray *folders, const char *namespace, else d(g_warning ("huh, no \"%c\" in \"%s\"?", separator, fi->url)); + pfi->full_name = g_strdup(url->path+1); + /* since this is a "fake" folder node, it is not selectable */ camel_url_set_param (url, "noselect", "yes"); pfi->url = camel_url_to_string (url, 0); camel_url_free (url); - + g_hash_table_insert (hash, pname, pfi); g_ptr_array_add (folders, pfi); } @@ -936,6 +955,7 @@ camel_folder_info_build (GPtrArray *folders, const char *namespace, } else if (!top) top = fi; } + g_hash_table_foreach(hash, free_name, NULL); g_hash_table_destroy (hash); /* Link together the top-level folders */ |