diff options
Diffstat (limited to 'camel/providers/local/camel-spool-folder.c')
-rw-r--r-- | camel/providers/local/camel-spool-folder.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/camel/providers/local/camel-spool-folder.c b/camel/providers/local/camel-spool-folder.c index 026d99402e..b9cb643189 100644 --- a/camel/providers/local/camel-spool-folder.c +++ b/camel/providers/local/camel-spool-folder.c @@ -41,6 +41,8 @@ #include "camel-stream-filter.h" #include "camel-mime-filter-from.h" #include "camel-exception.h" +#include "camel-session.h" +#include "camel-file-utils.h" #include "camel-lock-client.h" #include "camel-local-private.h" #include "camel-i18n.h" @@ -54,7 +56,9 @@ static CamelFolderClass *parent_class = NULL; #define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so)) #define CSPOOLS_CLASS(so) CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so)) -static CamelLocalSummary *spool_create_summary(const char *path, const char *folder, CamelIndex *index); +static char *spool_get_full_path(CamelLocalFolder *lf, const char *toplevel_dir, const char *full_name); +static char *spool_get_meta_path(CamelLocalFolder *lf, const char *toplevel_dir, const char *full_name, const char *ext); +static CamelLocalSummary *spool_create_summary(CamelLocalFolder *lf, const char *path, const char *folder, CamelIndex *index); static int spool_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex); static void spool_unlock(CamelLocalFolder *lf); @@ -68,7 +72,8 @@ camel_spool_folder_class_init(CamelSpoolFolderClass *klass) parent_class = (CamelFolderClass *)camel_mbox_folder_get_type(); - /* virtual method overload */ + lklass->get_full_path = spool_get_full_path; + lklass->get_meta_path = spool_get_meta_path; lklass->create_summary = spool_create_summary; lklass->lock = spool_lock; lklass->unlock = spool_unlock; @@ -117,7 +122,7 @@ camel_spool_folder_new(CamelStore *parent_store, const char *full_name, guint32 if (parent_store->flags & CAMEL_STORE_FILTER_INBOX && strcmp(full_name, "INBOX") == 0) folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT; - flags &= CAMEL_STORE_FOLDER_BODY_INDEX; + flags &= ~CAMEL_STORE_FOLDER_BODY_INDEX; folder = (CamelFolder *)camel_local_folder_construct((CamelLocalFolder *)folder, parent_store, full_name, flags, ex); if (folder) { @@ -128,8 +133,32 @@ camel_spool_folder_new(CamelStore *parent_store, const char *full_name, guint32 return folder; } +static char * +spool_get_full_path(CamelLocalFolder *lf, const char *toplevel_dir, const char *full_name) +{ + return g_strdup_printf ("%s/%s", toplevel_dir, full_name); +} + +static char * +spool_get_meta_path(CamelLocalFolder *lf, const char *toplevel_dir, const char *full_name, const char *ext) +{ + CamelService *service = (CamelService *)((CamelFolder *)lf)->parent_store; + char *root = camel_session_get_storage_path(service->session, service, NULL); + char *path; + + if (root == NULL) + return NULL; + + + camel_mkdir(root, 0777); + path = g_strdup_printf("%s/%s%s", root, full_name, ext); + g_free(root); + + return path; +} + static CamelLocalSummary * -spool_create_summary(const char *path, const char *folder, CamelIndex *index) +spool_create_summary(CamelLocalFolder *lf, const char *path, const char *folder, CamelIndex *index) { return (CamelLocalSummary *)camel_spool_summary_new(folder); } |