[dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-sync.c, 1.14, 1.15

cras at dovecot.org cras at dovecot.org
Thu May 4 01:02:30 EEST 2006


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

Modified Files:
	dbox-sync.c 
Log Message:
Keep track of recent flags.



Index: dbox-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-sync.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- dbox-sync.c	27 Apr 2006 13:39:47 -0000	1.14
+++ dbox-sync.c	3 May 2006 22:02:28 -0000	1.15
@@ -75,6 +75,23 @@
 	return 0;
 }
 
+static int dbox_update_recent_flags(struct dbox_sync_context *ctx,
+				    uint32_t seq1, uint32_t seq2)
+{
+	uint32_t seq;
+	const struct mail_index_record *rec;
+
+	for (seq = seq1; seq <= seq2; seq++) {
+		if (mail_index_lookup(ctx->sync_view, seq, &rec) < 0) {
+			mail_storage_set_index_error(&ctx->mbox->ibox);
+			return -1;
+		}
+		if ((rec->flags & MAIL_RECENT) != 0)
+			index_mailbox_set_recent(&ctx->mbox->ibox, seq);
+	}
+	return 0;
+}
+
 static int dbox_sync_add(struct dbox_sync_context *ctx,
 			 const struct mail_index_sync_rec *sync_rec)
 {
@@ -108,6 +125,10 @@
 	case MAIL_INDEX_SYNC_TYPE_FLAGS:
 		dbox_sync_rec.value.flags.add = sync_rec->add_flags;
 		dbox_sync_rec.value.flags.remove = sync_rec->remove_flags;
+		if ((sync_rec->remove_flags & MAIL_RECENT) != 0) {
+			if (dbox_update_recent_flags(ctx, seq1, seq2) < 0)
+				return -1;
+		}
 		break;
 	case MAIL_INDEX_SYNC_TYPE_KEYWORD_ADD:
 	case MAIL_INDEX_SYNC_TYPE_KEYWORD_REMOVE:



More information about the dovecot-cvs mailing list