dovecot-2.2: imap: Don't advertise SPECIAL-USE if there are no s...

dovecot at dovecot.org dovecot at dovecot.org
Wed May 6 16:52:14 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/18b71db74d31
changeset: 18533:18b71db74d31
user:      Timo Sirainen <tss at iki.fi>
date:      Wed May 06 19:50:23 2015 +0300
description:
imap: Don't advertise SPECIAL-USE if there are no such mailboxes configured.

diffstat:

 configure.ac           |   2 +-
 src/imap/imap-client.c |  16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletions(-)

diffs (45 lines):

diff -r 6612d20f2fb8 -r 18b71db74d31 configure.ac
--- a/configure.ac	Wed May 06 16:16:11 2015 +0300
+++ b/configure.ac	Wed May 06 19:50:23 2015 +0300
@@ -2834,7 +2834,7 @@
 dnl IDLE doesn't really belong to banner. It's there just to make Blackberries
 dnl happy, because otherwise BIS server disables push email.
 capability_banner="IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE"
-capability="$capability_banner SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS SPECIAL-USE BINARY MOVE"
+capability="$capability_banner SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY MOVE"
 AC_DEFINE_UNQUOTED(CAPABILITY_STRING, "$capability", IMAP capabilities)
 AC_DEFINE_UNQUOTED(CAPABILITY_BANNER_STRING, "$capability_banner", IMAP capabilities advertised in banner) 
 
diff -r 6612d20f2fb8 -r 18b71db74d31 src/imap/imap-client.c
--- a/src/imap/imap-client.c	Wed May 06 16:16:11 2015 +0300
+++ b/src/imap/imap-client.c	Wed May 06 19:50:23 2015 +0300
@@ -55,6 +55,17 @@
 	client->urlauth_ctx = imap_urlauth_init(client->user, &config);
 }
 
+static bool user_has_special_use_mailboxes(struct mail_user *user)
+{
+	struct mail_namespace *ns;
+
+	for (ns = user->namespaces; ns != NULL; ns = ns->next) {
+		if (ns->special_use_mailboxes)
+			return TRUE;
+	}
+	return FALSE;
+}
+
 struct client *client_create(int fd_in, int fd_out, const char *session_id,
 			     struct mail_user *user,
 			     struct mail_storage_service_user *service_user,
@@ -143,6 +154,11 @@
 		if (!explicit_capability)
 			str_append(client->capability_string, " METADATA");
 	}
+	if (!explicit_capability && user_has_special_use_mailboxes(user)) {
+		/* Advertise SPECIAL-USE only if there are actually some
+		   SPECIAL-USE flags in mailbox configuration. */
+		str_append(client->capability_string, " SPECIAL-USE");
+	}
 
 	ident = mail_user_get_anvil_userip_ident(client->user);
 	if (ident != NULL) {


More information about the dovecot-cvs mailing list