bool create_parent_dir;
int ret;
+ if ((box->list->props & MAILBOX_LIST_PROP_NO_NOSELECT) != 0) {
+ /* Layout doesn't support creating \NoSelect mailboxes.
+ Switch to creating a selectable mailbox. */
+ directory = FALSE;
+ }
+
type = directory ? MAILBOX_LIST_PATH_TYPE_DIR :
MAILBOX_LIST_PATH_TYPE_MAILBOX;
if ((ret = mailbox_get_path_to(box, type, &path)) < 0)
return -1;
}
- if (directory &&
- (box->list->props & MAILBOX_LIST_PROP_NO_NOSELECT) == 0) {
+ if (directory) {
/* we only wanted to create the directory and it's done now */
return 0;
}
const char *root_dir, *p;
size_t len;
- if (list->set.iter_from_index_dir &&
+ if (list->set.iter_from_index_dir && !list->set.no_noselect &&
mailbox_list_path_is_index(list, type)) {
/* Don't auto-rmdir parent index directories with ITERINDEX.
Otherwise it'll get us into inconsistent state with a
const char *path;
int ret;
+ ret = mailbox_list_get_path(list, name,
+ MAILBOX_LIST_PATH_TYPE_MAILBOX, &path);
+ if (ret < 0)
+ return -1;
+ i_assert(ret > 0);
+
if ((list->flags & MAILBOX_LIST_FLAG_MAILBOX_FILES) != 0) {
- ret = mailbox_list_get_path(list, name,
- MAILBOX_LIST_PATH_TYPE_MAILBOX,
- &path);
- if (ret < 0)
- return -1;
- i_assert(ret > 0);
ret = mailbox_list_delete_mailbox_file(list, name, path);
} else {
ret = fs_list_delete_maildir(list, name);
}
+ if (ret == 0 && list->set.no_noselect)
+ mailbox_list_delete_until_root(list, path, MAILBOX_LIST_PATH_TYPE_MAILBOX);
i_assert(ret <= 0);
return mailbox_list_delete_finish_ret(list, name, ret == 0);
list->root_permissions.dir_create_mode = (mode_t)-1;
list->root_permissions.file_create_gid = (gid_t)-1;
list->changelog_timestamp = (time_t)-1;
+ if (set->no_noselect)
+ list->props |= MAILBOX_LIST_PROP_NO_NOSELECT;
/* copy settings */
if (set->root_dir != NULL) {
list->set.index_control_use_maildir_name =
set->index_control_use_maildir_name;
list->set.iter_from_index_dir = set->iter_from_index_dir;
+ list->set.no_noselect = set->no_noselect;
if (*set->mailbox_dir_name == '\0')
list->set.mailbox_dir_name = "";
} else if (strcmp(key, "ITERINDEX") == 0) {
set_r->iter_from_index_dir = TRUE;
continue;
+ } else if (strcmp(key, "NO-NOSELECT") == 0) {
+ set_r->no_noselect = TRUE;
+ continue;
} else {
*error_r = t_strdup_printf("Unknown setting: %s", key);
return -1;
faster storage. This could perhaps be made the default at some point,
but for now since it's less tested it's optional. */
bool iter_from_index_dir;
+ /* Avoid creating or listing \NoSelect mailboxes. */
+ bool no_noselect;
};
struct mailbox_permissions {