From cb13084bc24c04b16af88744f6eb67ae7f779018 Mon Sep 17 00:00:00 2001 From: Michael Zucci Date: Thu, 11 May 2000 20:46:13 +0000 Subject: > * 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 --- camel/providers/mbox/camel-mbox-folder.c | 6 ++++-- camel/providers/mbox/camel-mbox-summary.c | 21 ++++++++++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) (limited to 'camel/providers/mbox') 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); -- cgit v1.2.3