aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/local/camel-local-store.c
diff options
context:
space:
mode:
author8 <NotZed@Ximian.com>2001-10-28 13:10:56 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-10-28 13:10:56 +0800
commit78b66af8ce96ab41e476d3ebf36cd85fced6d781 (patch)
tree271e7655e09c1a0a89798739e941d519765cfaa9 /camel/providers/local/camel-local-store.c
parentb1d36fe27d0434b98176a670ca67e64e5d4bb11e (diff)
downloadgsoc2013-evolution-78b66af8ce96ab41e476d3ebf36cd85fced6d781.tar
gsoc2013-evolution-78b66af8ce96ab41e476d3ebf36cd85fced6d781.tar.gz
gsoc2013-evolution-78b66af8ce96ab41e476d3ebf36cd85fced6d781.tar.bz2
gsoc2013-evolution-78b66af8ce96ab41e476d3ebf36cd85fced6d781.tar.lz
gsoc2013-evolution-78b66af8ce96ab41e476d3ebf36cd85fced6d781.tar.xz
gsoc2013-evolution-78b66af8ce96ab41e476d3ebf36cd85fced6d781.tar.zst
gsoc2013-evolution-78b66af8ce96ab41e476d3ebf36cd85fced6d781.zip
Use path not protocol as the path part of the uri of the folder_created
2001-10-28 <NotZed@Ximian.com> * providers/local/camel-local-folder.c (camel_local_folder_construct): Use path not protocol as the path part of the uri of the folder_created event. * providers/local/camel-maildir-store.c (scan_dir): If FAST is set, dont try and scan for unread counts. * providers/local/camel-local-store.c (create_folder): Implement, just return the folderinfo of the folder matched, not all of it. * camel-store.c (camel_store_rename_folder): Rename the camelfolders before emitting the folderchanged event (otherwise vstore fails to pick up change. * camel-store.c (camel_store_init): Always use a default dir_sep of '/'. * camel-store.h (struct _CamelStore): Added a dir_sep to the base store so rename and whatnot can work, temporary fix for mixed dir separator in folder name api's. * providers/imap/camel-map-store.c: (imap_connect_online): Also set the store's dir_sep here. (imap_connect_offline): " svn path=/trunk/; revision=14275
Diffstat (limited to 'camel/providers/local/camel-local-store.c')
-rw-r--r--camel/providers/local/camel-local-store.c52
1 files changed, 50 insertions, 2 deletions
diff --git a/camel/providers/local/camel-local-store.c b/camel/providers/local/camel-local-store.c
index 918b8db420..9b48b91175 100644
--- a/camel/providers/local/camel-local-store.c
+++ b/camel/providers/local/camel-local-store.c
@@ -44,10 +44,10 @@ static CamelFolder *get_folder(CamelStore * store, const char *folder_name, guin
static char *get_name(CamelService *service, gboolean brief);
static CamelFolder *get_inbox (CamelStore *store, CamelException *ex);
static void rename_folder(CamelStore *store, const char *old_name, const char *new_name, CamelException *ex);
-static CamelFolderInfo *get_folder_info (CamelStore *store, const char *top,
- guint32 flags, CamelException *ex);
+static CamelFolderInfo *get_folder_info (CamelStore *store, const char *top, guint32 flags, CamelException *ex);
static void delete_folder(CamelStore *store, const char *folder_name, CamelException *ex);
static void rename_folder(CamelStore *store, const char *old, const char *new, CamelException *ex);
+static CamelFolderInfo *create_folder(CamelStore *store, const char *parent_name, const char *folder_name, CamelException *ex);
static CamelStoreClass *parent_class = NULL;
@@ -67,6 +67,7 @@ camel_local_store_class_init (CamelLocalStoreClass *camel_local_store_class)
camel_store_class->get_folder_info = get_folder_info;
camel_store_class->free_folder_info = camel_store_free_folder_info_full;
+ camel_store_class->create_folder = create_folder;
camel_store_class->delete_folder = delete_folder;
camel_store_class->rename_folder = rename_folder;
}
@@ -202,6 +203,53 @@ get_folder_info (CamelStore *store, const char *top,
return NULL;
}
+static CamelFolderInfo *
+create_folder(CamelStore *store, const char *parent_name, const char *folder_name, CamelException *ex)
+{
+ char *path = ((CamelLocalStore *)store)->toplevel_dir;
+ char *name;
+ CamelFolder *folder;
+ CamelFolderInfo *info = NULL;
+ struct stat st;
+
+ /* This is a pretty hacky version of create folder, but should basically work */
+
+ /* FIXME: The strings here are funny because of string freeze */
+
+ if (path[0] != '/') {
+ camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+ _("Store root %s is not an absolute path"), path);
+ return NULL;
+ }
+
+ name = g_strdup_printf("%s/%s/%s", path, parent_name, folder_name);
+
+ if (stat(name, &st) == 0 || errno != ENOENT) {
+ camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
+ _("Cannot get folder: %s: %s"), name, strerror(errno));
+ g_free(name);
+ return NULL;
+ }
+
+ g_free(name);
+
+ name = g_strdup_printf("%s/%s", parent_name, folder_name);
+
+ folder = ((CamelStoreClass *)((CamelObject *)store)->classfuncs)->get_folder(store, name, CAMEL_STORE_FOLDER_CREATE, ex);
+ if (folder) {
+ camel_object_unref((CamelObject *)folder);
+ info = ((CamelStoreClass *)((CamelObject *)store)->classfuncs)->get_folder_info(store, name, 0, ex);
+
+ /* get_folder(CREATE) will emit a folder_created event for us */
+ /*if (info)
+ camel_object_trigger_event((CamelObject *)store, "folder_created", info);*/
+ }
+
+ g_free(name);
+
+ return info;
+}
+
static int xrename(const char *oldp, const char *newp, const char *prefix, const char *suffix, int missingok, CamelException *ex)
{
struct stat st;