changeset 2319:7c7e372da1f3 HEAD

mbox recent fixes.
author Timo Sirainen <tss@iki.fi>
date Mon, 12 Jul 2004 01:45:29 +0300
parents 4e925eb04b10
children 8a6666a9ac98
files src/lib-storage/index/mbox/mbox-sync.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-sync.c	Mon Jul 12 00:09:30 2004 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync.c	Mon Jul 12 01:45:29 2004 +0300
@@ -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) {