changeset 6057:4d14254bc40a HEAD

Handle setting deleted mailboxes to nonexistent.
author Timo Sirainen <tss@iki.fi>
date Wed, 18 Jul 2007 03:15:08 +0300
parents b06dfb878783
children 07d08be5bbb8
files src/lib-index/mailbox-list-index-sync.c
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mailbox-list-index-sync.c	Wed Jul 18 02:26:08 2007 +0300
+++ b/src/lib-index/mailbox-list-index-sync.c	Wed Jul 18 03:15:08 2007 +0300
@@ -30,7 +30,10 @@
 	uint32_t dir_offset;
 
 	uint32_t created:1;
+	/* This record was seen while syncing, either as parent or as leaf */
 	uint32_t seen:1;
+	/* This record was seen as leaf while syncing, so it exists */
+	uint32_t exists:1;
 };
 
 struct mailbox_list_sync_dir {
@@ -273,9 +276,22 @@
 
 		if (p == NULL) {
 			/* leaf */
+			rec->exists = TRUE;
+			mail_index_update_flags(ctx->trans, rec->seq,
+				MODIFY_REMOVE,
+				MAILBOX_LIST_INDEX_FLAG_NONEXISTENT);
 			break;
 		}
 
+		/* we were handling a parent, continue with its child */
+		if (!rec->exists) {
+			/* Mark this mailbox non-existent for now. If it
+			   exists, this flag is removed later. */
+			mail_index_update_flags(ctx->trans, rec->seq,
+				MODIFY_ADD,
+				MAILBOX_LIST_INDEX_FLAG_NONEXISTENT);
+		}
+
 		if (rec->dir == NULL) {
 			if (rec->dir_offset != 0) {
 				if (mailbox_list_copy_sync_dir(ctx,