From cdacb644902c2f485c691d4b31b9a7e44438375b Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 14 Jul 2000 00:41:01 +0000 Subject: If the summary is for a smaller mbox, and rebuilding from the last-known * providers/mbox/camel-mbox-summary.c (camel_mbox_summary_load): If the summary is for a smaller mbox, and rebuilding from the last-known end position fails, try rebuilding from the beginning. Deals with the case where the user edits the mbox and makes it bigger, without adding new messages. svn path=/trunk/; revision=4163 --- camel/ChangeLog | 8 ++++++++ camel/providers/mbox/camel-mbox-summary.c | 15 +++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index ad8c26c456..0a0893bdcf 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,11 @@ +2000-07-13 Dan Winship + + * providers/mbox/camel-mbox-summary.c (camel_mbox_summary_load): + If the summary is for a smaller mbox, and rebuilding from the + last-known end position fails, try rebuilding from the beginning. + Deals with the case where the user edits the mbox and makes it + bigger, without adding new messages. + 2000-07-13 Jeffrey Stedfast * providers/imap/camel-imap-folder.c: diff --git a/camel/providers/mbox/camel-mbox-summary.c b/camel/providers/mbox/camel-mbox-summary.c index 5af28a63e1..4c826dbc28 100644 --- a/camel/providers/mbox/camel-mbox-summary.c +++ b/camel/providers/mbox/camel-mbox-summary.c @@ -383,8 +383,6 @@ camel_mbox_summary_load (CamelMboxSummary *mbs, int forceindex) } if (forceindex || camel_folder_summary_load (s) == -1) { - printf ("REBUILDING SUMMARY: %s\n", - forceindex ? "Summary non-existent." : "Summary load failed."); camel_folder_summary_clear (s); ret = summary_rebuild (mbs, 0); } else { @@ -407,25 +405,26 @@ camel_mbox_summary_load (CamelMboxSummary *mbs, int forceindex) if (st.st_size == mbs->folder_size && st.st_mtime == s->time) { if (minstart < st.st_size) { /* FIXME: Only clear the messages and reindex from this point forward */ - printf ("REBUILDING SUMMARY: Index file is incomplete.\n"); camel_folder_summary_clear (s); ret = summary_rebuild (mbs, 0); } } else { if (mbs->folder_size < st.st_size) { - printf ("REBUILDING SUMMARY: Summary is for a smaller mbox\n"); if (minstart < mbs->folder_size) { /* FIXME: only make it rebuild as necessary */ camel_folder_summary_clear (s); ret = summary_rebuild (mbs, 0); } else { ret = summary_rebuild (mbs, mbs->folder_size); + /* If that fails, it might be because a message was changed + * rather than appended... so try again from the beginning. + */ + if (ret == -1) { + camel_folder_summary_clear (s); + ret = summary_rebuild (mbs, 0); + } } } else { - if (mbs->folder_size > st.st_size) - printf ("REBUILDING_SUMMARY: Summary is for a bigger mbox\n"); - else - printf ("REBUILDING SUMMARY: Summary is for an older mbox\n"); camel_folder_summary_clear (s); ret = summary_rebuild (mbs, 0); } -- cgit v1.2.3