dovecot-2.2: imapc: Added a Courier-workaround for not returning...

dovecot at dovecot.org dovecot at dovecot.org
Tue Oct 29 19:42:19 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/c69d919edf63
changeset: 16892:c69d919edf63
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Oct 29 19:42:14 2013 +0200
description:
imapc: Added a Courier-workaround for not returning UIDNEXT on SELECT.

diffstat:

 src/lib-storage/index/imapc/imapc-storage.c |  53 ++++++++++++++++++----------
 1 files changed, 33 insertions(+), 20 deletions(-)

diffs (77 lines):

diff -r c120623cb109 -r c69d919edf63 src/lib-storage/index/imapc/imapc-storage.c
--- a/src/lib-storage/index/imapc/imapc-storage.c	Tue Oct 29 18:59:20 2013 +0200
+++ b/src/lib-storage/index/imapc/imapc-storage.c	Tue Oct 29 19:42:14 2013 +0200
@@ -669,7 +669,7 @@
 	return index_storage_mailbox_delete(box);
 }
 
-static int imapc_mailbox_get_status(struct mailbox *box,
+static int imapc_mailbox_run_status(struct mailbox *box,
 				    enum mailbox_status_items items,
 				    struct mailbox_status *status_r)
 {
@@ -678,25 +678,6 @@
 	struct imapc_simple_context sctx;
 	string_t *str;
 
-	if (mbox->guid_fetch_field_name != NULL ||
-	    IMAPC_BOX_HAS_FEATURE(mbox, IMAPC_FEATURE_GUID_FORCED))
-		status_r->have_guids = TRUE;
-
-	if (box->opened) {
-		imapc_mailbox_get_selected_status(mbox, items, status_r);
-		return 0;
-	}
-
-	/* mailbox isn't opened yet */
-	if ((items & (STATUS_FIRST_UNSEEN_SEQ | STATUS_KEYWORDS |
-		      STATUS_PERMANENT_FLAGS)) != 0) {
-		/* getting these requires opening the mailbox */
-		if (mailbox_open(box) < 0)
-			return -1;
-		imapc_mailbox_get_selected_status(mbox, items, status_r);
-		return 0;
-	}
-
 	str = t_str_new(256);
 	if ((items & STATUS_MESSAGES) != 0)
 		str_append(str, " MESSAGES");
@@ -726,6 +707,38 @@
 	return sctx.ret;
 }
 
+static int imapc_mailbox_get_status(struct mailbox *box,
+				    enum mailbox_status_items items,
+				    struct mailbox_status *status_r)
+{
+	struct imapc_mailbox *mbox = (struct imapc_mailbox *)box;
+
+	if (mbox->guid_fetch_field_name != NULL ||
+	    IMAPC_BOX_HAS_FEATURE(mbox, IMAPC_FEATURE_GUID_FORCED))
+		status_r->have_guids = TRUE;
+
+	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) {
+		/* getting these requires opening the mailbox */
+		if (mailbox_open(box) < 0)
+			return -1;
+		imapc_mailbox_get_selected_status(mbox, items, status_r);
+	} else {
+		if (imapc_mailbox_run_status(box, items, status_r) < 0)
+			return -1;
+	}
+
+	if (box->opened && (items & STATUS_UIDNEXT) != 0 &&
+	    mbox->sync_uid_next == 0) {
+		/* Courier-workaround, it doesn't send UIDNEXT on SELECT */
+		if (imapc_mailbox_run_status(box, STATUS_UIDNEXT, status_r) < 0)
+			return -1;
+	}
+	return 0;
+}
+
 static int imapc_mailbox_get_namespaces(struct imapc_storage *storage)
 {
 	enum imapc_capability capa;


More information about the dovecot-cvs mailing list