changeset 22705:f9b676b1b028

lib-storage: Add mail_namespace_is_inbox_noinferiors()
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Thu, 14 Dec 2017 01:23:01 +0200
parents a6c0bec02b57
children 6ea402d0c650
files src/lib-storage/mail-namespace.h
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/mail-namespace.h	Fri Dec 08 16:14:11 2017 +0200
+++ b/src/lib-storage/mail-namespace.h	Thu Dec 14 01:23:01 2017 +0200
@@ -190,4 +190,16 @@
    type=public namespace "wrong"). */
 bool mail_namespace_is_shared_user_root(struct mail_namespace *ns);
 
+/* Returns TRUE if namespace includes INBOX that should be \Noinferiors.
+   This happens when the namespace has a prefix, which is not empty and not
+   "INBOX". This happens, because if storage_name=INBOX/foo it would be
+   converted to vname=prefix/INBOX/foo. */
+static inline bool
+mail_namespace_is_inbox_noinferiors(struct mail_namespace *ns)
+{
+	return (ns->flags & NAMESPACE_FLAG_INBOX_USER) != 0 &&
+		ns->prefix_len > 0 &&
+		strncmp(ns->prefix, "INBOX", ns->prefix_len-1) != 0;
+}
+
 #endif