Mercurial > dovecot > core-2.2
changeset 18533:18b71db74d31
imap: Don't advertise SPECIAL-USE if there are no such mailboxes configured.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 06 May 2015 19:50:23 +0300 |
parents | 6612d20f2fb8 |
children | 94bd895721d8 |
files | configure.ac src/imap/imap-client.c |
diffstat | 2 files changed, 17 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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) {