[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-sync.c, 1.73, 1.74

cras at dovecot.org cras at dovecot.org
Sun Apr 2 19:32:53 EEST 2006


Update of /var/lib/cvs/dovecot/src/lib-storage/index/maildir
In directory talvi:/tmp/cvs-serv7892/lib-storage/index/maildir

Modified Files:
	maildir-sync.c 
Log Message:
If mailbox is opened in non-readonly state and there are mails in new/, make
sure they get moved to cur/ so that their recent-state gets removed.



Index: maildir-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/maildir/maildir-sync.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- maildir-sync.c	25 Mar 2006 11:09:17 -0000	1.73
+++ maildir-sync.c	2 Apr 2006 16:32:51 -0000	1.74
@@ -759,6 +759,7 @@
 			 const char *new_dir, const char *cur_dir,
 			 bool *new_changed_r, bool *cur_changed_r)
 {
+	struct index_mailbox *ibox = &mbox->ibox;
 	struct stat st;
 	time_t new_mtime, cur_mtime;
 
@@ -787,16 +788,20 @@
 	if ((mbox->dirty_cur_time == 0 && cur_mtime != mbox->last_cur_mtime) ||
 	    (new_mtime != mbox->last_new_mtime)) {
 		/* check if the index has been updated.. */
-		if (mail_index_refresh(mbox->ibox.index) < 0) {
-			mail_storage_set_index_error(&mbox->ibox);
+		if (mail_index_refresh(ibox->index) < 0) {
+			mail_storage_set_index_error(ibox);
 			return -1;
 		}
 
 		maildir_sync_update_from_header(mbox);
 	}
 
+	/* If we're removing recent flags, always sync new/ directory if
+	   it has mails. */
 	if (new_mtime != mbox->last_new_mtime ||
-	    new_mtime >= mbox->last_new_sync_time - MAILDIR_SYNC_SECS) {
+	    new_mtime >= mbox->last_new_sync_time - MAILDIR_SYNC_SECS ||
+	    (!ibox->keep_recent &&
+	     mail_index_get_header(ibox->view)->recent_messages_count > 0)) {
 		*new_changed_r = TRUE;
 		mbox->last_new_mtime = new_mtime;
 		mbox->last_new_sync_time = ioloop_time;



More information about the dovecot-cvs mailing list