[dovecot-cvs] dovecot/src/lib-index mailbox-list-index-sync.c, 1.12, 1.13

tss at dovecot.org tss at dovecot.org
Tue Apr 17 13:07:01 EEST 2007


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv17186/lib-index

Modified Files:
	mailbox-list-index-sync.c 
Log Message:
Mailbox list index fixes



Index: mailbox-list-index-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mailbox-list-index-sync.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- mailbox-list-index-sync.c	16 Mar 2007 00:33:52 -0000	1.12
+++ mailbox-list-index-sync.c	17 Apr 2007 10:06:59 -0000	1.13
@@ -214,12 +214,13 @@
 	const char *p, *hier_name;
 	struct mailbox_list_sync_dir *dir;
 	struct mailbox_list_sync_record *rec = NULL;
-	unsigned int idx;
+	unsigned int idx, child_flags;
 
 	if (ctx->failed)
 		return -1;
 
 	dir = ctx->sync_root;
+	child_flags = MAILBOX_LIST_INDEX_FLAG_CHILDREN;
 
 	t_push();
 	for (;;) {
@@ -237,15 +238,20 @@
 		}
 
 		if (rec != NULL) {
+			/* add CHILDREN flag to the parent and remove
+			   NOCHILDREN flag. if we happened to create the
+			   parent ourself, also add NONEXISTENT flag. */
 			mail_index_update_flags(ctx->trans, rec->seq,
-				MODIFY_REPLACE,
-				MAILBOX_LIST_INDEX_FLAG_NONEXISTENT |
-				MAILBOX_LIST_INDEX_FLAG_CHILDREN);
+						MODIFY_ADD, child_flags);
+			mail_index_update_flags(ctx->trans, rec->seq,
+					MODIFY_REMOVE,
+					MAILBOX_LIST_INDEX_FLAG_NOCHILDREN);
 		}
 
 		rec = mailbox_list_sync_dir_lookup(dir, hier_name, &idx);
 		if (rec == NULL) {
 			/* new record */
+			child_flags |= MAILBOX_LIST_INDEX_FLAG_NONEXISTENT;
 			rec = mailbox_list_alloc_add_record(ctx, dir,
 							    hier_name, idx);
 		} else if (rec->seq == 0) {



More information about the dovecot-cvs mailing list