aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorMichael Zucci <zucchi@src.gnome.org>2000-05-12 04:46:13 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-05-12 04:46:13 +0800
commitcb13084bc24c04b16af88744f6eb67ae7f779018 (patch)
treecaf9b9f3349d79de9adb45f0d54aadabae298ad0 /camel
parentd41602b8ecf24d2c99ce52a4f3fd1ed6a6300d34 (diff)
downloadgsoc2013-evolution-cb13084bc24c04b16af88744f6eb67ae7f779018.tar.gz
gsoc2013-evolution-cb13084bc24c04b16af88744f6eb67ae7f779018.tar.zst
gsoc2013-evolution-cb13084bc24c04b16af88744f6eb67ae7f779018.zip
> * providers/mbox/camel-mbox-folder.c (message_changed): Indicate
> the summary changed also. > > (camel_mbox_summary_update): Also save summary when done. > (camel_mbox_summary_expunge): Unindex items when deleting them. > (camel_mbox_summary_expunge): Save the index as well as the > summary. > (camel_folder_summary_touch): New function, indicate the summary > info changed. > (camel_folder_summary_remove): Dirty here. svn path=/trunk/; revision=2994
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog12
-rw-r--r--camel/camel-folder-summary.c11
-rw-r--r--camel/camel-folder-summary.h3
-rw-r--r--camel/providers/mbox/camel-mbox-folder.c6
-rw-r--r--camel/providers/mbox/camel-mbox-summary.c21
5 files changed, 49 insertions, 4 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 0d22e830e5..1d73c7d4e4 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,8 @@
+2000-05-11 NotZed <NotZed@HelixCode.com>
+
+ * providers/mbox/camel-mbox-folder.c (message_changed): Indicate
+ the summary changed also.
+
2000-05-11 Jeffrey Stedfast <fejj@stampede.org>
* providers/smtp/camel-smtp-transport.c: (smtp_helo):
@@ -10,9 +15,16 @@
* providers/mbox/camel-mbox-summary.c
(camel_mbox_summary_finalise): Free the folder path.
+ (camel_mbox_summary_update): Also save summary when done.
+ (camel_mbox_summary_expunge): Unindex items when deleting them.
+ (camel_mbox_summary_expunge): Save the index as well as the
+ summary.
* camel-folder-summary.c (camel_folder_summary_finalise): Free the
summary path.
+ (camel_folder_summary_touch): New function, indicate the summary
+ info changed.
+ (camel_folder_summary_remove): Dirty here.
* camel-internet-address.c (internet_decode): Free multiple entry
addresses properly.
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index 854017daa9..6f80a62325 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -367,13 +367,15 @@ camel_folder_summary_save(CamelFolderSummary *s)
g_assert(s->summary_path);
- printf("saving summary?\n");
+ printf("saving summary? '%s'\n", s->summary_path);
if ((s->flags & CAMEL_SUMMARY_DIRTY) == 0) {
printf("nup\n");
return 0;
}
+ printf("yep\n");
+
fd = open(s->summary_path, O_RDWR|O_CREAT, 0600);
if (fd == -1)
return -1;
@@ -493,6 +495,12 @@ perform_content_info_free(CamelFolderSummary *s, CamelMessageContentInfo *ci)
}
void
+camel_folder_summary_touch(CamelFolderSummary *s)
+{
+ s->flags |= CAMEL_SUMMARY_DIRTY;
+}
+
+void
camel_folder_summary_clear(CamelFolderSummary *s)
{
int i;
@@ -526,6 +534,7 @@ void camel_folder_summary_remove(CamelFolderSummary *s, CamelMessageInfo *info)
if (s->build_content && ci) {
perform_content_info_free(s, ci);
}
+ s->flags |= CAMEL_SUMMARY_DIRTY;
}
void camel_folder_summary_remove_uid(CamelFolderSummary *s, const char *uid)
diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h
index 71b7cab7cb..76cecffb31 100644
--- a/camel/camel-folder-summary.h
+++ b/camel/camel-folder-summary.h
@@ -146,6 +146,9 @@ guint32 camel_folder_summary_next_uid(CamelFolderSummary *s);
int camel_folder_summary_load(CamelFolderSummary *);
int camel_folder_summary_save(CamelFolderSummary *);
+/* set the dirty bit on the summary */
+void camel_folder_summary_touch(CamelFolderSummary *s);
+
/* add a new raw summary item */
void camel_folder_summary_add(CamelFolderSummary *, CamelMessageInfo *info);
diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c
index 05d00c608e..3403271e40 100644
--- a/camel/providers/mbox/camel-mbox-folder.c
+++ b/camel/providers/mbox/camel-mbox-folder.c
@@ -745,6 +745,7 @@ mbox_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelExcept
filter_from = (CamelMimeFilter *)camel_mime_filter_from_new();
camel_stream_filter_add((CamelStreamFilter *)filter_stream, filter_from);
camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), filter_stream, ex);
+#warning "we still need stream_close() for this"
if (!camel_exception_is_set (ex))
camel_stream_flush (filter_stream, ex);
@@ -833,9 +834,10 @@ message_changed(CamelMimeMessage *m, int type, CamelMboxFolder *mf)
switch (type) {
case MESSAGE_FLAGS_CHANGED:
info = camel_folder_summary_uid((CamelFolderSummary *)mf->summary, m->message_uid);
- if (info)
+ if (info) {
info->flags = m->flags | CAMEL_MESSAGE_FOLDER_FLAGGED;
- else
+ camel_folder_summary_touch((CamelFolderSummary *)mf->summary);
+ } else
g_warning("Message changed event on message not in summary: %s", m->message_uid);
break;
default:
diff --git a/camel/providers/mbox/camel-mbox-summary.c b/camel/providers/mbox/camel-mbox-summary.c
index ead844ee66..56ff1cb198 100644
--- a/camel/providers/mbox/camel-mbox-summary.c
+++ b/camel/providers/mbox/camel-mbox-summary.c
@@ -323,8 +323,23 @@ summary_rebuild(CamelMboxSummary *mbs, off_t offset)
int
camel_mbox_summary_update(CamelMboxSummary *mbs, off_t offset)
{
+ int ret;
+
mbs->index_force = FALSE;
- return summary_rebuild(mbs, offset);
+ ret = summary_rebuild(mbs, offset);
+
+#if 0
+#warning "Saving full summary and index after every summarisation is slow ..."
+ if (ret != -1) {
+ if (camel_folder_summary_save((CamelFolderSummary *)mbs) == -1)
+ g_warning("Could not save summary: %s", strerror(errno));
+ printf("summary saved\n");
+ if (mbs->index)
+ ibex_save(mbs->index);
+ printf("ibex saved\n");
+ }
+#endif
+ return ret;
}
int
@@ -581,6 +596,8 @@ camel_mbox_summary_expunge(CamelMboxSummary *mbs)
g_assert(!quick);
offset -= (info->info.content->endpos - info->frompos);
+ if (mbs->index)
+ ibex_unindex(mbs->index, info->info.uid);
camel_folder_summary_remove(s, (CamelMessageInfo *)info);
count--;
i--;
@@ -690,6 +707,8 @@ camel_mbox_summary_expunge(CamelMboxSummary *mbs)
s->time = st.st_mtime;
mbs->folder_size = st.st_size;
camel_folder_summary_save(s);
+ if (mbs->index)
+ ibex_save(mbs->index);
}
gtk_object_unref((GtkObject *)mp);