From b0f08544a680b029666ab0e43ebcd913f0b91965 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 27 Jun 2017 14:22:50 +0300 Subject: [PATCH] lib-storage: Make mailbox_is_autocreated() public This also removes duplicated code from acl plugin. --- src/lib-storage/mail-storage-private.h | 2 ++ src/lib-storage/mail-storage.c | 2 +- src/plugins/acl/acl-mailbox.c | 8 -------- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/lib-storage/mail-storage-private.h b/src/lib-storage/mail-storage-private.h index 8dd9e11f7e..3eea8feec2 100644 --- a/src/lib-storage/mail-storage-private.h +++ b/src/lib-storage/mail-storage-private.h @@ -774,6 +774,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 2405161e05..fb5b6aa003 100644 --- a/src/lib-storage/mail-storage.c +++ b/src/lib-storage/mail-storage.c @@ -836,7 +836,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 aa0c1751fb..4efcc0f103 100644 --- a/src/plugins/acl/acl-mailbox.c +++ b/src/plugins/acl/acl-mailbox.c @@ -112,14 +112,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)