From: Stephan Bosch Date: Thu, 5 Oct 2017 10:28:43 +0000 (+0200) Subject: lib-storage: mail-storage - Add mailbox_has_special_use(). X-Git-Tag: 2.3.9~110 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b9f273fdacbf9acd3ee129ceb8d8c2da7abf4550;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: mail-storage - Add mailbox_has_special_use(). Implements checking whether a mailbox has a particular special-use flag. --- diff --git a/src/lib-storage/mail-storage.c b/src/lib-storage/mail-storage.c index 4feda02fc1..802c7fd43c 100644 --- a/src/lib-storage/mail-storage.c +++ b/src/lib-storage/mail-storage.c @@ -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 = diff --git a/src/lib-storage/mail-storage.h b/src/lib-storage/mail-storage.h index 3c42707d07..fc5b1cfc07 100644 --- a/src/lib-storage/mail-storage.h +++ b/src/lib-storage/mail-storage.h @@ -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