diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2004-03-13 05:28:41 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-03-13 05:28:41 +0800 |
commit | e28d5364ac2716e911c121657a20923682c5b2b2 (patch) | |
tree | 3a19fe2fc718a493d67b11498d2668094671b7f3 /camel/providers/local/camel-mh-store.c | |
parent | 3f727f063b1e13a89588f9cd1e5cf45a89c391e1 (diff) | |
download | gsoc2013-evolution-e28d5364ac2716e911c121657a20923682c5b2b2.tar gsoc2013-evolution-e28d5364ac2716e911c121657a20923682c5b2b2.tar.gz gsoc2013-evolution-e28d5364ac2716e911c121657a20923682c5b2b2.tar.bz2 gsoc2013-evolution-e28d5364ac2716e911c121657a20923682c5b2b2.tar.lz gsoc2013-evolution-e28d5364ac2716e911c121657a20923682c5b2b2.tar.xz gsoc2013-evolution-e28d5364ac2716e911c121657a20923682c5b2b2.tar.zst gsoc2013-evolution-e28d5364ac2716e911c121657a20923682c5b2b2.zip |
Fixes for bug #55018.
2004-03-12 Jeffrey Stedfast <fejj@ximian.com>
Fixes for bug #55018.
* providers/local/camel-local-folder.c
(camel_local_folder_construct): Use camel_url_to_string() here
too, so we properly encode the fragment.
* providers/local/camel-mbox-store.c (get_folder_info): Use
CamelURL to properly encode the fi->uri. Pass the CamelURL into
scan_dir() so that scan_dir() can re-use it (rather than having to
malloc/parse/free for each file/dir)
(scan_dir): Use camel_url_to_string().
* providers/local/camel-maildir-store.c (get_folder_info): Same as
mbox.
(scan_dir): Same as mbox. We also need to set the
CAMEL_FOLDER_NOSELECT flag if appropriate.
* providers/local/camel-mh-store.c (get_folder_info): Same as mbox
and maildir.
(folders_scan): Now takes a url argument which we pass off to
folder_info_new().
(recursive_scan): Same.
(folder_info_new): Use camel_url_to_string().
svn path=/trunk/; revision=25050
Diffstat (limited to 'camel/providers/local/camel-mh-store.c')
-rw-r--r-- | camel/providers/local/camel-mh-store.c | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/camel/providers/local/camel-mh-store.c b/camel/providers/local/camel-mh-store.c index e1c03c2349..65f783cac9 100644 --- a/camel/providers/local/camel-mh-store.c +++ b/camel/providers/local/camel-mh-store.c @@ -329,22 +329,26 @@ fill_fi(CamelStore *store, CamelFolderInfo *fi, guint32 flags) } } -static CamelFolderInfo *folder_info_new(CamelStore *store, const char *root, const char *path, guint32 flags) +static CamelFolderInfo * +folder_info_new (CamelStore *store, CamelURL *url, const char *root, const char *path, guint32 flags) { + /* FIXME: need to set fi->flags = CAMEL_FOLDER_NOSELECT (and possibly others) when appropriate */ CamelFolderInfo *fi; char *base; base = strrchr(path, '/'); - + + camel_url_set_fragment (url, path); + /* Build the folder info structure. */ fi = g_malloc0(sizeof(*fi)); - fi->uri = g_strdup_printf("mh:%s#%s", root, path); + fi->uri = camel_url_to_string (url, 0); fi->full_name = g_strdup(path); fi->name = g_strdup(base?base+1:path); camel_folder_info_build_path(fi, '/'); fill_fi(store, fi, flags); - d(printf("New folderinfo:\n '%s'\n '%s'\n '%s'\n", fi->full_name, fi->url, fi->path)); + d(printf("New folderinfo:\n '%s'\n '%s'\n '%s'\n", fi->full_name, fi->uri, fi->path)); return fi; } @@ -357,7 +361,9 @@ struct _inode { /* Scan path, under root, for directories to add folders for. Both * root and path should have a trailing "/" if they aren't empty. */ -static void recursive_scan(CamelStore *store, CamelFolderInfo **fip, CamelFolderInfo *parent, GHashTable *visited, const char *root, const char *path, guint32 flags) +static void +recursive_scan (CamelStore *store, CamelURL *url, CamelFolderInfo **fip, CamelFolderInfo *parent, + GHashTable *visited, const char *root, const char *path, guint32 flags) { char *fullpath, *tmp; DIR *dp; @@ -388,7 +394,7 @@ static void recursive_scan(CamelStore *store, CamelFolderInfo **fip, CamelFolder g_hash_table_insert(visited, inew, inew); /* link in ... */ - fi = folder_info_new(store, root, path, flags); + fi = folder_info_new(store, url, root, path, flags); fi->parent = parent; fi->next = *fip; *fip = fi; @@ -414,10 +420,10 @@ static void recursive_scan(CamelStore *store, CamelFolderInfo **fip, CamelFolder /* otherwise, treat at potential node, and recurse, a bit more expensive than needed, but tough! */ if (path[0]) { tmp = g_strdup_printf("%s/%s", path, d->d_name); - recursive_scan(store, &fi->child, fi, visited, root, tmp, flags); + recursive_scan(store, url, &fi->child, fi, visited, root, tmp, flags); g_free(tmp); } else { - recursive_scan(store, &fi->child, fi, visited, root, d->d_name, flags); + recursive_scan(store, url, &fi->child, fi, visited, root, d->d_name, flags); } } @@ -427,7 +433,7 @@ static void recursive_scan(CamelStore *store, CamelFolderInfo **fip, CamelFolder /* scan a .folders file */ static void -folders_scan(CamelStore *store, const char *root, const char *top, CamelFolderInfo **fip, guint32 flags) +folders_scan(CamelStore *store, CamelURL *url, const char *root, const char *top, CamelFolderInfo **fip, guint32 flags) { CamelFolderInfo *fi; char line[512], *path, *tmp; @@ -490,7 +496,7 @@ folders_scan(CamelStore *store, const char *root, const char *top, CamelFolderIn path = g_strdup_printf("%s/%s", root, line); if (stat(path, &st) == 0 && S_ISDIR(st.st_mode)) { - fi = folder_info_new(store, root, line, flags); + fi = folder_info_new(store, url, root, line, flags); g_ptr_array_add(folders, fi); } g_free(path); @@ -530,20 +536,23 @@ static CamelFolderInfo * get_folder_info (CamelStore *store, const char *top, guint32 flags, CamelException *ex) { CamelFolderInfo *fi = NULL; + CamelURL *url; char *root; - + root = ((CamelService *)store)->url->path; + url = camel_url_copy (((CamelService *) store)->url); + /* use .folders if we are supposed to */ if (((CamelMhStore *)store)->flags & CAMEL_MH_DOTFOLDERS) { - folders_scan(store, root, top, &fi, flags); + folders_scan(store, url, root, top, &fi, flags); } else { GHashTable *visited = g_hash_table_new(inode_hash, inode_equal); if (top == NULL) top = ""; - recursive_scan(store, &fi, NULL, visited, root, top, flags); + recursive_scan(store, url, &fi, NULL, visited, root, top, flags); /* if we actually scanned from root, we have a "" root node we dont want */ if (fi != NULL && top[0] == 0) { @@ -558,6 +567,8 @@ get_folder_info (CamelStore *store, const char *top, guint32 flags, CamelExcepti g_hash_table_foreach(visited, inode_free, NULL); g_hash_table_destroy(visited); } - + + camel_url_free (url); + return fi; } |