dovecot-2.2: imapc: Fixed STATUS_FIRST_RECENT_UID to return the ...

dovecot at dovecot.org dovecot at dovecot.org
Tue Feb 17 14:03:13 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/f13c6f9e0174
changeset: 18256:f13c6f9e0174
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Feb 17 16:02:49 2015 +0200
description:
imapc: Fixed STATUS_FIRST_RECENT_UID to return the (mostly) correct UID.

diffstat:

 src/lib-storage/index/imapc/imapc-mailbox.c |  10 ++++++++--
 src/lib-storage/index/imapc/imapc-storage.c |   5 ++++-
 src/lib-storage/index/imapc/imapc-storage.h |   1 +
 3 files changed, 13 insertions(+), 3 deletions(-)

diffs (59 lines):

diff -r d3bb7541ca5e -r f13c6f9e0174 src/lib-storage/index/imapc/imapc-mailbox.c
--- a/src/lib-storage/index/imapc/imapc-mailbox.c	Sun Feb 15 10:11:01 2015 +0200
+++ b/src/lib-storage/index/imapc/imapc-mailbox.c	Tue Feb 17 16:02:49 2015 +0200
@@ -303,14 +303,20 @@
 				have_labels = TRUE;
 		}
 	}
-	/* FIXME: need to do something about recent flags */
-	flags &= ~MAIL_RECENT;
 
 	imapc_mailbox_init_delayed_trans(mbox);
 	if (imapc_mailbox_msgmap_update(mbox, rseq, fetch_uid,
 					&lseq, &uid) < 0 || uid == 0)
 		return;
 
+	if ((flags & MAIL_RECENT) == 0 && mbox->highest_nonrecent_uid < uid) {
+		/* remember for STATUS_FIRST_RECENT_UID */
+		mbox->highest_nonrecent_uid = uid;
+	}
+	/* FIXME: we should ideally also pass these through so they show up
+	   to clients. */
+	flags &= ~MAIL_RECENT;
+
 	/* if this is a reply to some FETCH request, update the mail's fields */
 	array_foreach(&mbox->fetch_requests, fetch_requestp) {
 		array_foreach(&(*fetch_requestp)->mails, mailp) {
diff -r d3bb7541ca5e -r f13c6f9e0174 src/lib-storage/index/imapc/imapc-storage.c
--- a/src/lib-storage/index/imapc/imapc-storage.c	Sun Feb 15 10:11:01 2015 +0200
+++ b/src/lib-storage/index/imapc/imapc-storage.c	Tue Feb 17 16:02:49 2015 +0200
@@ -676,6 +676,8 @@
 	index_storage_get_open_status(&mbox->box, items, status_r);
 	if ((items & STATUS_PERMANENT_FLAGS) != 0)
 		status_r->permanent_flags = mbox->permanent_flags;
+	if ((items & STATUS_FIRST_RECENT_UID) != 0)
+		status_r->first_recent_uid = mbox->highest_nonrecent_uid + 1;
 }
 
 static int imapc_mailbox_delete(struct mailbox *box)
@@ -735,7 +737,8 @@
 	if (box->opened) {
 		imapc_mailbox_get_selected_status(mbox, items, status_r);
 	} else if ((items & (STATUS_FIRST_UNSEEN_SEQ | STATUS_KEYWORDS |
-			     STATUS_PERMANENT_FLAGS)) != 0) {
+			     STATUS_PERMANENT_FLAGS |
+			     STATUS_FIRST_RECENT_UID)) != 0) {
 		/* getting these requires opening the mailbox */
 		if (mailbox_open(box) < 0)
 			return -1;
diff -r d3bb7541ca5e -r f13c6f9e0174 src/lib-storage/index/imapc/imapc-storage.h
--- a/src/lib-storage/index/imapc/imapc-storage.h	Sun Feb 15 10:11:01 2015 +0200
+++ b/src/lib-storage/index/imapc/imapc-storage.h	Tue Feb 17 16:02:49 2015 +0200
@@ -101,6 +101,7 @@
 	ARRAY(struct imapc_mailbox_event_callback) resp_text_callbacks;
 
 	enum mail_flags permanent_flags;
+	uint32_t highest_nonrecent_uid;
 
 	ARRAY_TYPE(uint32_t) delayed_expunged_uids;
 	uint32_t sync_uid_validity;


More information about the dovecot-cvs mailing list