storage->temp_prefix = p_strdup(_storage->pool,
mailbox_list_get_temp_prefix(list));
- if (list->set.control_dir == NULL && list->set.inbox_path == NULL &&
+ if (list->mail_set->mail_control_path[0] == '\0' &&
+ list->set.inbox_path == NULL &&
(ns->flags & NAMESPACE_FLAG_INBOX_ANY) != 0) {
/* put the temp files into tmp/ directory preferably */
storage->temp_prefix = p_strconcat(_storage->pool, "tmp/",
case MAILBOX_LIST_PATH_TYPE_INDEX_CACHE:
case MAILBOX_LIST_PATH_TYPE_LIST_INDEX:
if (name == NULL && type == MAILBOX_LIST_PATH_TYPE_CONTROL &&
- list->set.control_dir != NULL) {
+ list->mail_set->mail_control_path[0] != '\0') {
/* kind of a kludge for backwards compatibility:
the subscriptions file is in the root control_dir
without .imap/ suffix */
if (type == MAILBOX_LIST_PATH_TYPE_INDEX)
return TRUE;
- /* e.g. CONTROL dir could point to the same INDEX dir. */
+ /* e.g. mail_control_path could point to the same INDEX dir. */
type_root = mailbox_list_get_root_forced(list, type);
index_root = mailbox_list_get_root_forced(list, MAILBOX_LIST_PATH_TYPE_INDEX);
return strcmp(type_root, index_root) == 0;
mailbox_list_get_path(list, name, MAILBOX_LIST_PATH_TYPE_INDEX,
&index_path) > 0 &&
strcmp(index_path, path) == 0) {
- /* CONTROL dir is the same as INDEX dir, which we already
+ /* mail_control_path is the same as INDEX dir, which we already
deleted. We don't want to continue especially with
mailbox_list_iter_from_index_dir=yes, because it could be
deleting the index directory. */
}
/* Note that only mail_alt_path currently uses maildir_name in paths.
- INDEX and CONTROL don't. */
+ INDEX and mail_control_path don't. */
if (type != MAILBOX_LIST_PATH_TYPE_ALT_MAILBOX ||
*list->set.maildir_name == '\0') {
/* this directory may contain also child mailboxes' data.
int mailbox_list_delete_mailbox_nonrecursive(struct mailbox_list *list,
const char *name, const char *path,
bool rmdir_path);
-/* Lookup INDEX, CONTROL and mail_alt_path directories for the mailbox and
- delete them.
+/* Lookup INDEX, mail_control_path and mail_alt_path directories for the
+ mailbox and delete them.
Returns 1 if anything was unlink()ed or rmdir()ed, 0 if not.
Returns -1 and sets the list error on any errors. */
int mailbox_list_delete_finish(struct mailbox_list *list, const char *name);
root_dir = mail_set->mail_alt_path;
break;
case MAILBOX_LIST_PATH_TYPE_CONTROL:
- if (set->control_dir != NULL) {
- *path_r = fs_list_get_path_to(_list, set->control_dir, name);
+ if (mail_set->mail_control_path[0] != '\0') {
+ *path_r = fs_list_get_path_to(_list,
+ mail_set->mail_control_path, name);
return 1;
}
break;
return -1;
}
- type = _list->set.control_dir != NULL ?
+ type = _list->mail_set->mail_control_path[0] != '\0' ?
MAILBOX_LIST_PATH_TYPE_CONTROL : MAILBOX_LIST_PATH_TYPE_DIR;
path = t_strconcat(mailbox_list_get_root_forced(_list, type),
return -1;
}
- path = t_strconcat(_list->set.control_dir != NULL ?
- _list->set.control_dir : _list->set.root_dir,
+ path = t_strconcat(_list->mail_set->mail_control_path[0] != '\0' ?
+ _list->mail_set->mail_control_path :
+ _list->set.root_dir,
"/", _list->mail_set->mailbox_subscriptions_filename,
NULL);
return subsfile_set_subscribed(_list, path, list->temp_prefix,
root_dir = _list->mail_set->mail_alt_path;
break;
case MAILBOX_LIST_PATH_TYPE_CONTROL:
- if (_list->set.control_dir != NULL) {
+ if (_list->mail_set->mail_control_path[0] != '\0') {
*path_r = maildir_list_get_dirname_path(_list,
- _list->set.control_dir, name);
+ _list->mail_set->mail_control_path, name);
return 1;
}
break;
return -1;
}
- path = t_strconcat(_list->set.control_dir != NULL ?
- _list->set.control_dir : _list->set.root_dir,
+ path = t_strconcat(_list->mail_set->mail_control_path[0] != '\0' ?
+ _list->mail_set->mail_control_path :
+ _list->set.root_dir,
"/", _list->mail_set->mailbox_subscriptions_filename,
NULL);
dest_list->subscriptions = mailbox_tree_init(sep);
}
- type = src_list->set.control_dir != NULL ?
+ type = src_list->mail_set->mail_control_path[0] != '\0' ?
MAILBOX_LIST_PATH_TYPE_CONTROL : MAILBOX_LIST_PATH_TYPE_DIR;
if (!mailbox_list_get_root_path(src_list, type, &path) ||
src_list->mail_set->mailbox_subscriptions_filename[0] == '\0') {
perm.file_create_gid_origin, &dotlock);
if (fd_out == -1 && errno == ENOENT) {
/* directory hasn't been created yet. */
- type = list->set.control_dir != NULL ?
+ type = list->mail_set->mail_control_path[0] != '\0' ?
MAILBOX_LIST_PATH_TYPE_CONTROL :
MAILBOX_LIST_PATH_TYPE_DIR;
fname = strrchr(path, '/');
DEF(BOOL_HIDDEN, mailbox_list_validate_fs_names),
DEF(STR_HIDDEN, mailbox_root_directory_name),
DEF(STR_HIDDEN, mailbox_subscriptions_filename),
+ DEF(STR, mail_control_path),
DEF(STR, mail_volatile_path),
DEF(STR, mail_alt_path),
DEF(BOOL_HIDDEN, mail_alt_check),
.mailbox_list_validate_fs_names = TRUE,
.mailbox_root_directory_name = "",
.mailbox_subscriptions_filename = "subscriptions",
+ .mail_control_path = "",
.mail_volatile_path = "",
.mail_alt_path = "",
.mail_alt_check = TRUE,
const char *set_name;
enum mailbox_list_path_type type;
} set_types[] = {
+ { "mail_control_path", MAILBOX_LIST_PATH_TYPE_CONTROL },
{ "mail_alt_path", MAILBOX_LIST_PATH_TYPE_ALT_DIR },
};
for (unsigned int i = 0; i < N_ELEMENTS(set_types); i++) {
OFFSET(mailbox_list_iter_from_index_dir),
OFFSET(mailbox_root_directory_name),
OFFSET(mailbox_subscriptions_filename),
+ OFFSET(mail_control_path),
OFFSET(mail_volatile_path),
OFFSET(mail_alt_path),
OFFSET(mail_alt_check),
bool mailbox_list_validate_fs_names;
const char *mailbox_root_directory_name;
const char *mailbox_subscriptions_filename;
+ const char *mail_control_path;
const char *mail_volatile_path;
const char *mail_alt_path;
bool mail_alt_check;
list1->ns->set->name, list2->ns->set->name);
return FALSE;
}
- if (!nullequals(list1->set.control_dir, list2->set.control_dir)) {
- *error_r = t_strdup_printf("Namespace %s has control dir, %s doesn't",
+ if (!nullequals(list1->mail_set->mail_control_path,
+ list2->mail_set->mail_control_path)) {
+ *error_r = t_strdup_printf(
+ "Namespace %s has mail_control_path, %s doesn't",
list1->ns->set->name, list2->ns->set->name);
return FALSE;
}
list->set.index_cache_dir = set->index_cache_dir == NULL ||
strcmp(set->index_cache_dir, set->root_dir) == 0 ? NULL :
p_strdup(list->pool, set->index_cache_dir);
- list->set.control_dir = set->control_dir == NULL ||
- strcmp(set->control_dir, set->root_dir) == 0 ? NULL :
- p_strdup(list->pool, set->control_dir);
}
list->set.inbox_path = p_strdup(list->pool, set->inbox_path);
list->set.root_dir == NULL ? "" : list->set.root_dir,
list->set.index_dir == NULL ? "" : list->set.index_dir,
list->set.index_pvt_dir == NULL ? "" : list->set.index_pvt_dir,
- list->set.control_dir == NULL ?
- "" : list->set.control_dir,
+ mail_set->mail_control_path,
list->set.inbox_path == NULL ?
"" : list->set.inbox_path,
mail_set->mail_alt_path);
dest = &set_r->index_pvt_dir;
else if (strcmp(key, "INDEXCACHE") == 0)
dest = &set_r->index_cache_dir;
- else if (strcmp(key, "CONTROL") == 0)
- dest = &set_r->control_dir;
else if (strcmp(key, "DIRNAME") == 0)
dest = &set_r->maildir_name;
else if (strcmp(key, "FULLDIRNAME") == 0) {
return "";
switch (type) {
+ case MAILBOX_LIST_PATH_TYPE_CONTROL:
+ type = MAILBOX_LIST_PATH_TYPE_DIR;
+ break;
case MAILBOX_LIST_PATH_TYPE_LIST_INDEX:
type = MAILBOX_LIST_PATH_TYPE_INDEX;
break;
case MAILBOX_LIST_PATH_TYPE_ALT_MAILBOX:
break;
case MAILBOX_LIST_PATH_TYPE_CONTROL:
- path = set->control_dir != NULL ?
- set->control_dir : set->root_dir;
break;
case MAILBOX_LIST_PATH_TYPE_LIST_INDEX:
break;
mail_set->mailbox_root_directory_name, NULL);
}
break;
+ case MAILBOX_LIST_PATH_TYPE_CONTROL:
+ path = mail_set->mail_control_path[0] != '\0' ?
+ mail_set->mail_control_path : list->set.root_dir;
+ break;
case MAILBOX_LIST_PATH_TYPE_LIST_INDEX:
if (mail_set->parsed_list_index_dir != NULL) {
if (mail_set->parsed_list_index_dir[0] == '/') {
const char *index_dir;
const char *index_pvt_dir;
const char *index_cache_dir;
- const char *control_dir;
const char *inbox_path;
/* If non-empty, it means that mails exist in a maildir_name