]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: mail-storage - Add mailbox_has_special_use().
authorStephan Bosch <stephan.bosch@dovecot.fi>
Thu, 5 Oct 2017 10:28:43 +0000 (12:28 +0200)
committerStephan Bosch <stephan.bosch@open-xchange.com>
Tue, 8 Oct 2019 17:14:56 +0000 (19:14 +0200)
Implements checking whether a mailbox has a particular special-use flag.

src/lib-storage/mail-storage.c
src/lib-storage/mail-storage.h

index 4feda02fc1da7b4c78d5d24756df85581a6862e1..802c7fd43c4197d3c4da91d83f45c8345508a812 100644 (file)
@@ -1667,6 +1667,13 @@ bool mailbox_is_any_inbox(struct mailbox *box)
        return box->inbox_any;
 }
 
+bool mailbox_has_special_use(struct mailbox *box, const char *special_use)
+{
+       if (box->set == NULL)
+               return FALSE;
+       return str_contains_special_use(box->set->special_use, special_use);
+}
+
 static void mailbox_copy_cache_decisions_from_inbox(struct mailbox *box)
 {
        struct mail_namespace *ns =
index 3c42707d07fe7d4d36f32183c8587d5e554784c2..fc5b1cfc070f97045d49be2372c187df09131576 100644 (file)
@@ -558,6 +558,9 @@ bool mailbox_equals(const struct mailbox *box1,
 /* Returns TRUE if the mailbox is user's INBOX or another user's shared INBOX */
 bool mailbox_is_any_inbox(struct mailbox *box);
 
+/* Returns TRUE if the mailbox has the specified special use flag assigned. */
+bool mailbox_has_special_use(struct mailbox *box, const char *special_use);
+
 /* Change mailbox_verify_create_name() to not verify new mailbox name
    restrictions (but still check that it's a valid existing name). This is
    mainly used by dsync to make sure the sync works even though the original