[dovecot-cvs] dovecot/src/lib-index/mbox mbox-index.c,1.44,1.45 mbox-rewrite.c,1.38,1.39

cras at procontrol.fi cras at procontrol.fi
Wed Nov 20 19:06:48 EET 2002


Update of /home/cvs/dovecot/src/lib-index/mbox
In directory danu:/tmp/cvs-serv19042/mbox

Modified Files:
	mbox-index.c mbox-rewrite.c 
Log Message:
If first message with our X-IMAPbase is deleted, make sure it's added back.



Index: mbox-index.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/mbox-index.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- mbox-index.c	5 Nov 2002 07:58:57 -0000	1.44
+++ mbox-index.c	20 Nov 2002 17:06:46 -0000	1.45
@@ -740,6 +740,21 @@
 	return mail_index_try_lock(index, lock_type);
 }
 
+int mbox_index_expunge(MailIndex *index, MailIndexRecord *rec,
+		       unsigned int seq, int external_change)
+{
+	if (!mail_index_expunge(index, rec, seq, external_change))
+		return FALSE;
+
+	if (seq == 1) {
+		/* Our message containing X-IMAPbase was deleted.
+		   Get it back there. */
+		index->header->flags |= MAIL_INDEX_FLAG_DIRTY_MESSAGES |
+			MAIL_INDEX_FLAG_DIRTY_CUSTOMFLAGS;
+	}
+	return TRUE;
+}
+
 static int mbox_index_update_flags(MailIndex *index, MailIndexRecord *rec,
 				   unsigned int seq, MailFlags flags,
 				   int external_change)
@@ -772,7 +787,7 @@
 	mail_index_cache_fields_later,
 	mbox_open_mail,
 	mail_get_internal_date,
-	mail_index_expunge,
+	mbox_index_expunge,
 	mbox_index_update_flags,
 	mail_index_append_begin,
 	mail_index_append_end,

Index: mbox-rewrite.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/mbox-rewrite.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- mbox-rewrite.c	13 Nov 2002 01:36:16 -0000	1.38
+++ mbox-rewrite.c	20 Nov 2002 17:06:46 -0000	1.39
@@ -393,6 +393,9 @@
 	return ret;
 }
 
+#define INDEX_DIRTY_FLAGS \
+        (MAIL_INDEX_FLAG_DIRTY_MESSAGES | MAIL_INDEX_FLAG_DIRTY_CUSTOMFLAGS)
+
 int mbox_index_rewrite(MailIndex *index)
 {
 	/* Write messages beginning from the first dirty one to temp file,
@@ -412,7 +415,7 @@
 	if (!index->set_lock(index, MAIL_LOCK_SHARED))
 		return FALSE;
 
-        rewrite = (index->header->flags & MAIL_INDEX_FLAG_DIRTY_MESSAGES);
+        rewrite = (index->header->flags & INDEX_DIRTY_FLAGS);
 
 	if (!index->set_lock(index, MAIL_LOCK_UNLOCK))
 		return FALSE;
@@ -435,8 +438,7 @@
 		if (inbuf == NULL)
 			break;
 
-		if ((index->header->flags &
-		     MAIL_INDEX_FLAG_DIRTY_MESSAGES) == 0) {
+		if ((index->header->flags & INDEX_DIRTY_FLAGS) == 0) {
 			/* fsck() figured out there's no dirty messages
 			   after all */
 			failed = FALSE; rewrite = FALSE;




More information about the dovecot-cvs mailing list