From: Timo Sirainen Date: Tue, 27 Jun 2017 11:22:50 +0000 (+0300) Subject: lib-storage: Make mailbox_is_autocreated() public X-Git-Tag: 2.2.32.rc1~37 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a0a9861a7747d01e8e1fb96bfb9ec1f8b1559783;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Make mailbox_is_autocreated() public This also removes duplicated code from acl plugin. --- diff --git a/src/lib-storage/mail-storage-private.h b/src/lib-storage/mail-storage-private.h index 12b7f4443b..25e5c672d4 100644 --- a/src/lib-storage/mail-storage-private.h +++ b/src/lib-storage/mail-storage-private.h @@ -783,6 +783,8 @@ int mailbox_mkdir(struct mailbox *box, const char *path, Optimized for case where the directory usually exists. */ int mailbox_create_missing_dir(struct mailbox *box, enum mailbox_list_path_type type); +/* Returns TRUE if mailbox is autocreated. */ +bool mailbox_is_autocreated(struct mailbox *box); /* Returns -1 if error, 0 if failed with EEXIST, 1 if ok */ int mailbox_create_fd(struct mailbox *box, const char *path, int flags, diff --git a/src/lib-storage/mail-storage.c b/src/lib-storage/mail-storage.c index a205c1139d..0fb3c6b396 100644 --- a/src/lib-storage/mail-storage.c +++ b/src/lib-storage/mail-storage.c @@ -858,7 +858,7 @@ void mailbox_set_reason(struct mailbox *box, const char *reason) box->reason = p_strdup(box->pool, reason); } -static bool mailbox_is_autocreated(struct mailbox *box) +bool mailbox_is_autocreated(struct mailbox *box) { if (box->inbox_user) return TRUE; diff --git a/src/plugins/acl/acl-mailbox.c b/src/plugins/acl/acl-mailbox.c index 2970399ec7..177f6a40a3 100644 --- a/src/plugins/acl/acl-mailbox.c +++ b/src/plugins/acl/acl-mailbox.c @@ -111,14 +111,6 @@ static void acl_mailbox_copy_acls_from_parent(struct mailbox *box) acl_object_deinit(&parent_aclobj); } -static bool mailbox_is_autocreated(struct mailbox *box) -{ - if (box->inbox_user) - return TRUE; - return box->set != NULL && - strcmp(box->set->autocreate, MAILBOX_SET_AUTO_NO) != 0; -} - static int acl_mailbox_create(struct mailbox *box, const struct mailbox_update *update, bool directory)