[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-sync.c, 1.57, 1.58

cras at dovecot.org cras at dovecot.org
Mon Jul 12 01:45:32 EEST 2004


Update of /home/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv11136/lib-storage/index/mbox

Modified Files:
	mbox-sync.c 
Log Message:
mbox recent fixes.



Index: mbox-sync.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- mbox-sync.c	3 Jul 2004 18:13:45 -0000	1.57
+++ mbox-sync.c	11 Jul 2004 22:45:29 -0000	1.58
@@ -211,12 +211,13 @@
 
 	/* save the offset permanently with recent flag state */
 	mail_ctx->mail.from_offset = mail_ctx->from_offset;
-	if ((mail_ctx->mail.flags & MBOX_NONRECENT) == 0) {
+	if ((mail_ctx->mail.flags & MBOX_NONRECENT) == 0 && !mail_ctx->pseudo) {
 		if (!sync_ctx->ibox->keep_recent) {
 			/* need to add 'O' flag to Status-header */
 			mail_ctx->need_rewrite = TRUE;
 		}
-		// FIXME: save it somewhere
+		index_mailbox_set_recent(sync_ctx->ibox,
+					 mail_ctx->seq - mail_ctx->pseudo);
 	}
 	return 1;
 }
@@ -442,6 +443,9 @@
 		/* new message */
 		mail_index_append(sync_ctx->t, mail->uid, &sync_ctx->idx_seq);
 		mbox_flags = mail->flags & (MAIL_FLAGS_MASK^MAIL_RECENT);
+		if (sync_ctx->ibox->keep_recent &&
+		    (mail->flags & MBOX_NONRECENT) == 0)
+			mbox_flags |= MAIL_RECENT;
 		mail_index_update_flags(sync_ctx->t, sync_ctx->idx_seq,
 					MODIFY_REPLACE, mbox_flags,
 					mail->keywords);
@@ -469,6 +473,9 @@
 		mbox_flags = (rec->flags & ~MAIL_FLAGS_MASK) |
 			(mail->flags & (MAIL_FLAGS_MASK^MAIL_RECENT));
 
+		if (!sync_ctx->ibox->keep_recent)
+			mbox_flags &= ~MAIL_RECENT;
+
 		if (idx_flags != mbox_flags ||
 		    memcmp(idx_keywords, mail->keywords,
 			   INDEX_KEYWORDS_BYTE_COUNT) != 0) {



More information about the dovecot-cvs mailing list