aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/imap/camel-imap-folder.c18
-rw-r--r--camel/providers/imap/camel-imap-folder.h5
-rw-r--r--camel/providers/imap/camel-imap-store.c8
3 files changed, 23 insertions, 8 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 4db0c7a43f..a4c40c6635 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -216,7 +216,7 @@ camel_imap_folder_new (CamelStore *parent, const char *folder_name,
CamelFolder *folder;
CamelImapFolder *imap_folder;
const char *short_name;
- char *summary_file;
+ char *summary_file, *state_file;
if (camel_mkdir (folder_dir, S_IRWXU) != 0) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
@@ -244,6 +244,12 @@ camel_imap_folder_new (CamelStore *parent, const char *folder_name,
return NULL;
}
+ /* set/load persistent state */
+ state_file = g_strdup_printf ("%s/cmeta", folder_dir);
+ camel_object_set(folder, NULL, CAMEL_OBJECT_STATE_FILE, state_file, NULL);
+ g_free(state_file);
+ camel_object_state_read(folder);
+
imap_folder = CAMEL_IMAP_FOLDER (folder);
imap_folder->cache = camel_imap_message_cache_new (folder_dir, folder->summary, ex);
if (!imap_folder->cache) {
@@ -406,7 +412,7 @@ static int
imap_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args)
{
CamelFolder *folder = (CamelFolder *)object;
- int i, count=args->argc;
+ int i, count=0;
guint32 tag;
for (i=0;i<args->argc;i++) {
@@ -426,7 +432,7 @@ imap_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args)
*arg->ca_str = folder->description;
break;
default:
- count--;
+ count++;
continue;
}
@@ -444,7 +450,7 @@ imap_rename (CamelFolder *folder, const char *new)
{
CamelImapFolder *imap_folder = (CamelImapFolder *)folder;
CamelImapStore *imap_store = (CamelImapStore *)folder->parent_store;
- char *folder_dir, *summary_path;
+ char *folder_dir, *summary_path, *state_file;
char *folders;
folders = g_strconcat (imap_store->storage_path, "/folders", NULL);
@@ -458,6 +464,10 @@ imap_rename (CamelFolder *folder, const char *new)
camel_folder_summary_set_filename(folder->summary, summary_path);
+ state_file = g_strdup_printf ("%s/cmeta", folder_dir);
+ camel_object_set(folder, NULL, CAMEL_OBJECT_STATE_FILE, state_file, NULL);
+ g_free(state_file);
+
g_free(summary_path);
g_free(folder_dir);
diff --git a/camel/providers/imap/camel-imap-folder.h b/camel/providers/imap/camel-imap-folder.h
index a49f7bd497..4cadebc65b 100644
--- a/camel/providers/imap/camel-imap-folder.h
+++ b/camel/providers/imap/camel-imap-folder.h
@@ -47,11 +47,12 @@ struct _CamelImapFolder {
struct _CamelImapFolderPrivate *priv;
- gboolean need_rescan, need_refresh;
CamelFolderSearch *search;
CamelImapMessageCache *cache;
-};
+ unsigned int need_rescan:1;
+ unsigned int need_refresh:1;
+};
typedef struct {
CamelDiscoFolderClass parent_class;
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 4b4250da18..d8ff6e0ec7 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -1042,7 +1042,7 @@ imap_forget_folder (CamelImapStore *imap_store, const char *folder_name, CamelEx
{
CamelFolderSummary *summary;
CamelImapMessageCache *cache;
- char *summary_file;
+ char *summary_file, *state_file;
char *journal_file;
char *folder_dir, *storage_path;
CamelFolderInfo *fi;
@@ -1080,9 +1080,13 @@ imap_forget_folder (CamelImapStore *imap_store, const char *folder_name, CamelEx
unlink (summary_file);
g_free (summary_file);
- journal_file = g_strdup_printf ("%s/summary", folder_dir);
+ journal_file = g_strdup_printf ("%s/journal", folder_dir);
unlink (journal_file);
g_free (journal_file);
+
+ state_file = g_strdup_printf ("%s/cmeta", folder_dir);
+ unlink (state_file);
+ g_free (state_file);
rmdir (folder_dir);
g_free (folder_dir);