aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/local/camel-mbox-store.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2004-03-13 05:28:41 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-03-13 05:28:41 +0800
commite28d5364ac2716e911c121657a20923682c5b2b2 (patch)
tree3a19fe2fc718a493d67b11498d2668094671b7f3 /camel/providers/local/camel-mbox-store.c
parent3f727f063b1e13a89588f9cd1e5cf45a89c391e1 (diff)
downloadgsoc2013-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-mbox-store.c')
-rw-r--r--camel/providers/local/camel-mbox-store.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/camel/providers/local/camel-mbox-store.c b/camel/providers/local/camel-mbox-store.c
index 595445f99c..45d91b1fa6 100644
--- a/camel/providers/local/camel-mbox-store.c
+++ b/camel/providers/local/camel-mbox-store.c
@@ -633,7 +633,7 @@ fill_fi(CamelStore *store, CamelFolderInfo *fi, guint32 flags)
}
static CamelFolderInfo *
-scan_dir(CamelStore *store, GHashTable *visited, CamelFolderInfo *parent, const char *root,
+scan_dir(CamelStore *store, CamelURL *url, GHashTable *visited, CamelFolderInfo *parent, const char *root,
const char *name, guint32 flags, CamelException *ex)
{
CamelFolderInfo *folders, *tail, *fi;
@@ -694,16 +694,14 @@ scan_dir(CamelStore *store, GHashTable *visited, CamelFolderInfo *parent, const
fi->flags =(fi->flags & ~CAMEL_FOLDER_NOCHILDREN) | CAMEL_FOLDER_CHILDREN;
} else {
fi->flags &= ~CAMEL_FOLDER_NOSELECT;
- if ((ext = strchr(fi->uri, ';')) && !strncmp(ext, ";noselect=yes", 13))
- memmove(ext, ext + 13, strlen(ext + 13) + 1);
}
} else {
fi = g_new0(CamelFolderInfo, 1);
fi->parent = parent;
- /* add ";noselect=yes" if we haven't found the mbox file yet. when we find it, remove the noselect */
- fi->uri = g_strdup_printf("mbox:%s%s#%s",((CamelService *) store)->url->path,
- S_ISDIR(st.st_mode) ? ";noselect=yes" : "", full_name);
+ camel_url_set_fragment (url, full_name);
+
+ fi->uri = camel_url_to_string (url, 0);
fi->name = short_name;
fi->full_name = full_name;
fi->path = g_strdup_printf("/%s", full_name);
@@ -725,9 +723,9 @@ scan_dir(CamelStore *store, GHashTable *visited, CamelFolderInfo *parent, const
g_hash_table_insert(folder_hash, fi->name, fi);
}
- if (!S_ISDIR(st.st_mode))
+ if (!S_ISDIR(st.st_mode)) {
fill_fi(store, fi, flags);
- else if ((flags & CAMEL_STORE_FOLDER_INFO_RECURSIVE)) {
+ } else if ((flags & CAMEL_STORE_FOLDER_INFO_RECURSIVE)) {
struct _inode in = { st.st_dev, st.st_ino };
if (g_hash_table_lookup(visited, &in) == NULL) {
@@ -737,7 +735,7 @@ scan_dir(CamelStore *store, GHashTable *visited, CamelFolderInfo *parent, const
g_hash_table_insert(visited, inew, inew);
- if ((fi->child = scan_dir(store, visited, fi, path, fi->full_name, flags, ex)))
+ if ((fi->child = scan_dir (store, url, visited, fi, path, fi->full_name, flags, ex)))
fi->flags |= CAMEL_FOLDER_CHILDREN;
else
fi->flags =(fi->flags & ~CAMEL_FOLDER_CHILDREN) | CAMEL_FOLDER_NOCHILDREN;
@@ -763,10 +761,13 @@ get_folder_info(CamelStore *store, const char *top, guint32 flags, CamelExceptio
CamelFolderInfo *fi;
const char *base;
struct stat st;
+ CamelURL *url;
top = top ? top : "";
path = mbox_folder_name_to_path(store, top);
+ printf ("mbox_get_folder_info for '%s'; path = %s\n", top, path);
+
if (*top == '\0') {
/* requesting root dir scan */
if (stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) {
@@ -782,10 +783,12 @@ get_folder_info(CamelStore *store, const char *top, guint32 flags, CamelExceptio
g_hash_table_insert(visited, inode, inode);
- fi = scan_dir(store, visited, NULL, path, NULL, flags, ex);
+ url = camel_url_copy (((CamelService *) store)->url);
+ fi = scan_dir (store, url, visited, NULL, path, NULL, flags, ex);
g_hash_table_foreach(visited, inode_free, NULL);
g_hash_table_destroy(visited);
- g_free(path);
+ camel_url_free (url);
+ g_free (path);
return fi;
}
@@ -802,24 +805,31 @@ get_folder_info(CamelStore *store, const char *top, guint32 flags, CamelExceptio
base = top;
else
base++;
-
+
+ url = camel_url_copy (((CamelService *) store)->url);
+ camel_url_set_fragment (url, top);
+
fi = g_new0(CamelFolderInfo, 1);
fi->parent = NULL;
- fi->uri = g_strdup_printf("mbox:%s#%s",((CamelService *) store)->url->path, top);
+ fi->uri = camel_url_to_string (url, 0);
fi->name = g_strdup(base);
fi->full_name = g_strdup(top);
fi->unread = -1;
fi->total = -1;
fi->path = g_strdup_printf("/%s", top);
+ printf ("fi->uri = %s\n\n", fi->uri);
+
subdir = g_strdup_printf("%s.sbd", path);
if (stat(subdir, &st) == 0) {
if (S_ISDIR(st.st_mode))
- fi->child = scan_dir(store, visited, fi, subdir, top, flags, ex);
+ fi->child = scan_dir (store, url, visited, fi, subdir, top, flags, ex);
else
fill_fi(store, fi, flags);
}
+ camel_url_free (url);
+
if (fi->child)
fi->flags |= CAMEL_FOLDER_CHILDREN;
else