dovecot-2.1: lib-storage: If alias_for references inbox=yes name...

dovecot at dovecot.org dovecot at dovecot.org
Tue Aug 14 03:03:45 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/0d3f2902fb68
changeset: 14665:0d3f2902fb68
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Aug 14 03:01:07 2012 +0300
description:
lib-storage: If alias_for references inbox=yes namespace, copy the inbox=yes to the alias ns.
So even though this still doesn't allow giving multiple inbox=yes settings
in configuration file, it's now possible for multiple namespaces to have
them. They just need to point to the exact same INBOX.

diffstat:

 src/lib-storage/mail-namespace.c |  11 +++++++++--
 src/lib-storage/mail-namespace.h |   5 +++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diffs (52 lines):

diff -r 68a62d79b1b4 -r 0d3f2902fb68 src/lib-storage/mail-namespace.c
--- a/src/lib-storage/mail-namespace.c	Tue Aug 14 01:54:34 2012 +0300
+++ b/src/lib-storage/mail-namespace.c	Tue Aug 14 03:01:07 2012 +0300
@@ -178,6 +178,11 @@
 		if (!namespace_is_valid_alias_storage(ns, error_r))
 			return -1;
 
+		if ((ns->alias_for->flags & NAMESPACE_FLAG_INBOX_USER) != 0) {
+			/* copy inbox=yes */
+			ns->flags |= NAMESPACE_FLAG_INBOX_USER;
+		}
+
 		ns->alias_chain_next = ns->alias_for->alias_chain_next;
 		ns->alias_for->alias_chain_next = ns;
 	}
@@ -200,10 +205,9 @@
 				ns->prefix);
 			return FALSE;
 		}
-		if (namespace_set_alias_for(ns, namespaces, error_r) < 0)
-			return FALSE;
 		if ((ns->flags & NAMESPACE_FLAG_HIDDEN) == 0)
 			visible_namespaces = TRUE;
+		/* check the inbox=yes status before alias_for changes it */
 		if ((ns->flags & NAMESPACE_FLAG_INBOX_USER) != 0) {
 			if (inbox_ns != NULL) {
 				*error_r = "There can be only one namespace with "
@@ -212,6 +216,9 @@
 			}
 			inbox_ns = ns;
 		}
+		if (namespace_set_alias_for(ns, namespaces, error_r) < 0)
+			return FALSE;
+
 		if (*ns->prefix != '\0' &&
 		    (ns->flags & (NAMESPACE_FLAG_LIST_PREFIX |
 				  NAMESPACE_FLAG_LIST_CHILDREN)) != 0 &&
diff -r 68a62d79b1b4 -r 0d3f2902fb68 src/lib-storage/mail-namespace.h
--- a/src/lib-storage/mail-namespace.h	Tue Aug 14 01:54:34 2012 +0300
+++ b/src/lib-storage/mail-namespace.h	Tue Aug 14 03:01:07 2012 +0300
@@ -12,8 +12,9 @@
 };
 
 enum namespace_flags {
-	/* Namespace contains the user's INBOX mailbox (there can be only
-	   one) */
+	/* Namespace contains the user's INBOX mailbox. Normally only a single
+	   namespace has this flag set, but when using alias_for for the INBOX
+	   namespace the flag gets copied to the alias namespace as well */
 	NAMESPACE_FLAG_INBOX_USER	= 0x01,
 	/* Namespace contains someone's INBOX. This is set for both user's
 	   INBOX namespace and also for any other users' shared namespaces. */


More information about the dovecot-cvs mailing list