dovecot-2.2: lib-storage: Fixed mailbox_status.unseen count for ...

dovecot at dovecot.org dovecot at dovecot.org
Thu Jun 21 14:52:07 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/73ee8d00888d
changeset: 14619:73ee8d00888d
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jun 21 14:51:36 2012 +0300
description:
lib-storage: Fixed mailbox_status.unseen count for private indexes.

diffstat:

 src/lib-storage/index/index-status.c |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r 344bd3d47ced -r 73ee8d00888d src/lib-storage/index/index-status.c
--- a/src/lib-storage/index/index-status.c	Wed Jun 20 06:32:06 2012 +0300
+++ b/src/lib-storage/index/index-status.c	Thu Jun 21 14:51:36 2012 +0300
@@ -33,7 +33,7 @@
 			     enum mailbox_status_items items,
 			     struct mailbox_status *status_r)
 {
-	const struct mail_index_header *hdr;
+	const struct mail_index_header *hdr, *hdr_pvt;
 
 	memset(status_r, 0, sizeof(struct mailbox_status));
 
@@ -46,6 +46,8 @@
 
 	/* we can get most of the status items without any trouble */
 	hdr = mail_index_get_header(box->view);
+	hdr_pvt = box->view_pvt == NULL ? NULL :
+		mail_index_get_header(box->view_pvt);
 	status_r->messages = hdr->messages_count;
 	if ((items & STATUS_RECENT) != 0) {
 		/* make sure recent count is set, in case syncing hasn't
@@ -54,7 +56,14 @@
 		status_r->recent = index_mailbox_get_recent_count(box);
 		i_assert(status_r->recent <= status_r->messages);
 	}
-	status_r->unseen = hdr->messages_count - hdr->seen_messages_count;
+	if (hdr_pvt == NULL ||
+	    (mailbox_get_private_flags_mask(box) & MAIL_SEEN) == 0) {
+		status_r->unseen = hdr->messages_count -
+			hdr->seen_messages_count;
+	} else {
+		status_r->unseen = hdr_pvt->messages_count -
+			hdr_pvt->seen_messages_count;
+	}
 	status_r->uidvalidity = hdr->uid_validity;
 	status_r->uidnext = hdr->next_uid;
 	status_r->first_recent_uid = hdr->first_recent_uid;


More information about the dovecot-cvs mailing list