aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/mh
diff options
context:
space:
mode:
authorNot Zed <NotZed@HelixCode.com>2000-11-02 11:35:04 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-11-02 11:35:04 +0800
commitf351369e5127337eb95185ac764b6744faf4b87f (patch)
tree57654b3a2d65743b8670b2f583f15639a368616a /camel/providers/mh
parent24e7b7d5fcfe1d98a912570c554b74ca1a9f0f64 (diff)
downloadgsoc2013-evolution-f351369e5127337eb95185ac764b6744faf4b87f.tar.gz
gsoc2013-evolution-f351369e5127337eb95185ac764b6744faf4b87f.tar.zst
gsoc2013-evolution-f351369e5127337eb95185ac764b6744faf4b87f.zip
Merged in camel-incremental-branch.
2000-11-02 Not Zed <NotZed@HelixCode.com> * Merged in camel-incremental-branch. svn path=/trunk/; revision=6336
Diffstat (limited to 'camel/providers/mh')
-rw-r--r--camel/providers/mh/camel-mh-folder.c22
-rw-r--r--camel/providers/mh/camel-mh-folder.h1
-rw-r--r--camel/providers/mh/camel-mh-summary.c5
-rw-r--r--camel/providers/mh/camel-mh-summary.h3
4 files changed, 20 insertions, 11 deletions
diff --git a/camel/providers/mh/camel-mh-folder.c b/camel/providers/mh/camel-mh-folder.c
index 5b5c6688d7..a56de4a9c1 100644
--- a/camel/providers/mh/camel-mh-folder.c
+++ b/camel/providers/mh/camel-mh-folder.c
@@ -125,6 +125,7 @@ static void mh_init(gpointer object, gpointer klass)
mh_folder->summary = NULL;
mh_folder->search = NULL;
+ mh_folder->changes = camel_folder_change_info_new();
}
static void mh_finalize(CamelObject * object)
@@ -138,6 +139,7 @@ static void mh_finalize(CamelObject * object)
g_free(mh_folder->summary_file_path);
g_free(mh_folder->folder_dir_path);
g_free(mh_folder->index_file_path);
+ camel_folder_change_info_free(mh_folder->changes);
}
CamelType camel_mh_folder_get_type(void)
@@ -222,8 +224,11 @@ static void mh_sync(CamelFolder * folder, gboolean expunge, CamelException * ex)
if (expunge)
mh_expunge(folder, ex);
- else
- camel_mh_summary_sync(mh_folder->summary, FALSE, ex);
+ else {
+ camel_mh_summary_sync(mh_folder->summary, FALSE, mh_folder->changes, ex);
+ camel_object_trigger_event(CAMEL_OBJECT(folder), "folder_changed", mh_folder->changes);
+ camel_folder_change_info_clear(mh_folder->changes);
+ }
/* save index */
if (mh_folder->index)
@@ -234,12 +239,11 @@ static void mh_sync(CamelFolder * folder, gboolean expunge, CamelException * ex)
static void mh_expunge(CamelFolder * folder, CamelException * ex)
{
- CamelMhFolder *mh = CAMEL_MH_FOLDER(folder);
-
- camel_mh_summary_sync(mh->summary, TRUE, ex);
+ CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- /* TODO: check it actually changed */
- camel_object_trigger_event(CAMEL_OBJECT(folder), "folder_changed", GINT_TO_POINTER (0));
+ camel_mh_summary_sync(mh_folder->summary, TRUE, mh_folder->changes, ex);
+ camel_object_trigger_event(CAMEL_OBJECT(folder), "folder_changed", mh_folder->changes);
+ camel_folder_change_info_clear(mh_folder->changes);
}
static gint mh_get_message_count(CamelFolder * folder)
@@ -319,7 +323,9 @@ static void mh_append_message(CamelFolder * folder, CamelMimeMessage * message,
}
}
- camel_object_trigger_event(CAMEL_OBJECT(folder), "folder_changed", GPOINTER_TO_INT (0));
+ camel_folder_change_info_add_uid(mh_folder->changes, uid);
+ camel_object_trigger_event(CAMEL_OBJECT(folder), "folder_changed", mh_folder->changes);
+ camel_folder_change_info_clear(mh_folder->changes);
g_free(name);
g_free(uid);
return;
diff --git a/camel/providers/mh/camel-mh-folder.h b/camel/providers/mh/camel-mh-folder.h
index bdb1588811..ddfdf2b4aa 100644
--- a/camel/providers/mh/camel-mh-folder.h
+++ b/camel/providers/mh/camel-mh-folder.h
@@ -52,6 +52,7 @@ typedef struct {
ibex *index; /* index for this folder */
CamelMhSummary *summary;
CamelFolderSearch *search; /* used to run searches, we just use the real thing (tm) */
+ CamelFolderChangeInfo *changes; /* mass changes to the folder */
} CamelMhFolder;
typedef struct {
diff --git a/camel/providers/mh/camel-mh-summary.c b/camel/providers/mh/camel-mh-summary.c
index ce1d597012..c757a9a0a9 100644
--- a/camel/providers/mh/camel-mh-summary.c
+++ b/camel/providers/mh/camel-mh-summary.c
@@ -248,7 +248,7 @@ int camel_mh_summary_check(CamelMhSummary * mhs, int forceindex)
/* sync the summary with the ondisk files.
It doesnt store the state in the file, the summary only, == MUCH faster */
-int camel_mh_summary_sync(CamelMhSummary * mhs, int expunge, CamelException *ex)
+int camel_mh_summary_sync(CamelMhSummary * mhs, int expunge, CamelFolderChangeInfo *changes, CamelException *ex)
{
int count, i;
CamelMessageInfo *info;
@@ -267,8 +267,9 @@ int camel_mh_summary_sync(CamelMhSummary * mhs, int expunge, CamelException *ex
info = camel_folder_summary_index((CamelFolderSummary *)mhs, i);
if (info && info->flags & CAMEL_MESSAGE_DELETED) {
name = g_strdup_printf("%s/%s", mhs->mh_path, info->uid);
- (printf("deleting %s\n", name));
+ d(printf("deleting %s\n", name));
if (unlink(name) == 0 || errno==ENOENT) {
+ camel_folder_change_info_remove_uid(changes, info->uid);
camel_folder_summary_remove((CamelFolderSummary *)mhs, info);
}
}
diff --git a/camel/providers/mh/camel-mh-summary.h b/camel/providers/mh/camel-mh-summary.h
index 28376c5d9b..81aa91b418 100644
--- a/camel/providers/mh/camel-mh-summary.h
+++ b/camel/providers/mh/camel-mh-summary.h
@@ -22,6 +22,7 @@
#define _CAMEL_MH_SUMMARY_H
#include <camel/camel-folder-summary.h>
+#include <camel/camel-folder.h>
#include <camel/camel-exception.h>
#include <libibex/ibex.h>
@@ -55,7 +56,7 @@ CamelMhSummary *camel_mh_summary_new (const char *filename, const char *mhdir, i
int camel_mh_summary_load(CamelMhSummary * mhs, int forceindex);
int camel_mh_summary_check(CamelMhSummary * mhs, int forceindex);
int camel_mh_summary_add(CamelMhSummary * mhs, const char *name, int forceindex);
-int camel_mh_summary_sync(CamelMhSummary * mhs, int expunge, CamelException *ex);
+int camel_mh_summary_sync(CamelMhSummary * mhs, int expunge, CamelFolderChangeInfo *changes, CamelException *ex);
#endif /* ! _CAMEL_MH_SUMMARY_H */