}
if (alt_path == NULL) {
- e_warning(event,
- "%s: Original ALT=%s, but currently no ALT path set",
+ e_warning(event, "%s: Original mail_alt_path=%s, "
+ "but currently mail_alt_path is empty",
root_dir, linkpath);
return TRUE;
} else if (strcmp(linkpath, alt_path) != 0) {
mdbox. we'll silently replace the symlink. */
return TRUE;
}
- e_warning(event, "%s: Original ALT=%s, but currently ALT=%s",
+ e_warning(event, "%s: Original mail_alt_path=%s, "
+ "but currently mail_alt_path=%s",
root_dir, linkpath, alt_path);
return TRUE;
}
dir = mailbox_list_get_root_forced(ns->list, MAILBOX_LIST_PATH_TYPE_DIR);
storage->storage_dir = p_strconcat(_storage->pool, dir,
"/"MDBOX_GLOBAL_DIR_NAME, NULL);
- if (ns->list->set.alt_dir != NULL) {
+ if (ns->list->mail_set->mail_alt_path[0] != '\0') {
storage->alt_storage_dir = p_strconcat(_storage->pool,
- ns->list->set.alt_dir,
- "/"MDBOX_GLOBAL_DIR_NAME, NULL);
+ ns->list->mail_set->mail_alt_path,
+ "/"MDBOX_GLOBAL_DIR_NAME, NULL);
}
event_set_append_log_prefix(_storage->event, t_strdup_printf(
return 0;
}
- /* Note that only ALT currently uses maildir_name in paths.
+ /* Note that only mail_alt_path currently uses maildir_name in paths.
INDEX and CONTROL don't. */
if (type != MAILBOX_LIST_PATH_TYPE_ALT_MAILBOX ||
*list->set.maildir_name == '\0') {
int mailbox_list_delete_mailbox_nonrecursive(struct mailbox_list *list,
const char *name, const char *path,
bool rmdir_path);
-/* Lookup INDEX, CONTROL and ALT directories for the mailbox and delete them.
+/* Lookup INDEX, CONTROL 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);
}
break;
case MAILBOX_LIST_PATH_TYPE_ALT_DIR:
- if (set->alt_dir == NULL)
+ if (mail_set->mail_alt_path[0] == '\0')
return 0;
if (*set->maildir_name != '\0') {
/* maildir_name is for the mailbox, caller is asking
for the directory name */
- *path_r = t_strdup_printf("%s/%s%s", set->alt_dir,
+ *path_r = t_strdup_printf("%s/%s%s",
+ mail_set->mail_alt_path,
mail_set->parsed_mailbox_root_directory_prefix,
name);
return 1;
}
- root_dir = set->alt_dir;
+ root_dir = mail_set->mail_alt_path;
break;
case MAILBOX_LIST_PATH_TYPE_MAILBOX:
break;
case MAILBOX_LIST_PATH_TYPE_ALT_MAILBOX:
- if (set->alt_dir == NULL)
+ if (mail_set->mail_alt_path[0] == '\0')
return 0;
- root_dir = set->alt_dir;
+ root_dir = mail_set->mail_alt_path;
break;
case MAILBOX_LIST_PATH_TYPE_CONTROL:
if (set->control_dir != NULL) {
break;
case MAILBOX_LIST_PATH_TYPE_ALT_DIR:
case MAILBOX_LIST_PATH_TYPE_ALT_MAILBOX:
- if (_list->set.alt_dir == NULL)
+ if (_list->mail_set->mail_alt_path[0] == '\0')
return 0;
- root_dir = _list->set.alt_dir;
+ root_dir = _list->mail_set->mail_alt_path;
break;
case MAILBOX_LIST_PATH_TYPE_CONTROL:
if (_list->set.control_dir != NULL) {
DEF(STR_HIDDEN, mailbox_root_directory_name),
DEF(STR_HIDDEN, mailbox_subscriptions_filename),
DEF(STR, mail_volatile_path),
+ DEF(STR, mail_alt_path),
DEF(BOOL_HIDDEN, mail_alt_check),
DEF(BOOL_HIDDEN, mail_full_filesystem_access),
DEF(BOOL, maildir_stat_dirs),
.mailbox_root_directory_name = "",
.mailbox_subscriptions_filename = "subscriptions",
.mail_volatile_path = "",
+ .mail_alt_path = "",
.mail_alt_check = TRUE,
.mail_full_filesystem_access = FALSE,
.maildir_stat_dirs = FALSE,
*type_r = MAILBOX_LIST_PATH_TYPE_LIST_INDEX;
return TRUE;
}
+ struct {
+ const char *set_name;
+ enum mailbox_list_path_type type;
+ } set_types[] = {
+ { "mail_alt_path", MAILBOX_LIST_PATH_TYPE_ALT_DIR },
+ };
+ for (unsigned int i = 0; i < N_ELEMENTS(set_types); i++) {
+ if (strcmp(set_types[i].set_name, key) == 0) {
+ *type_r = set_types[i].type;
+ return TRUE;
+ }
+ }
return FALSE;
}
OFFSET(mailbox_root_directory_name),
OFFSET(mailbox_subscriptions_filename),
OFFSET(mail_volatile_path),
+ OFFSET(mail_alt_path),
OFFSET(mail_alt_check),
};
const char *mailbox_root_directory_name;
const char *mailbox_subscriptions_filename;
const char *mail_volatile_path;
+ const char *mail_alt_path;
bool mail_alt_check;
bool mail_full_filesystem_access;
bool maildir_stat_dirs;
struct mailbox_list *list2,
const char **error_r)
{
- if (!nullequals(list1->set.alt_dir, list2->set.alt_dir)) {
- *error_r = t_strdup_printf("Namespace %s has alt dir, %s doesn't",
+ if (!nullequals(list1->mail_set->mail_alt_path,
+ list2->mail_set->mail_alt_path)) {
+ *error_r = t_strdup_printf(
+ "Namespace %s has mail_alt_path, %s doesn't",
list1->ns->set->name, list2->ns->set->name);
return FALSE;
}
return -1;
}
if ((class->props & MAILBOX_LIST_PROP_NO_ALT_DIR) != 0 &&
- set->alt_dir != NULL) {
- *error_r = "alt_dir not supported by this driver";
+ mail_set->mail_alt_path[0] != '\0') {
+ *error_r = "mail_alt_path not supported by this driver";
return -1;
}
list->set.inbox_path = p_strdup(list->pool, set->inbox_path);
list->set.maildir_name =
p_strdup(list->pool, set->maildir_name);
- list->set.alt_dir = p_strdup(list->pool, set->alt_dir);
list->set.index_control_use_maildir_name =
set->index_control_use_maildir_name;
"" : list->set.control_dir,
list->set.inbox_path == NULL ?
"" : list->set.inbox_path,
- list->set.alt_dir == NULL ? "" : list->set.alt_dir);
+ mail_set->mail_alt_path);
if ((flags & MAILBOX_LIST_FLAG_SECONDARY) == 0)
mail_namespace_finish_list_init(ns, list);
dest = &set_r->index_cache_dir;
else if (strcmp(key, "CONTROL") == 0)
dest = &set_r->control_dir;
- else if (strcmp(key, "ALT") == 0)
- dest = &set_r->alt_dir;
else if (strcmp(key, "DIRNAME") == 0)
dest = &set_r->maildir_name;
else if (strcmp(key, "FULLDIRNAME") == 0) {
path = set->root_dir;
break;
case MAILBOX_LIST_PATH_TYPE_ALT_DIR:
- path = set->alt_dir;
break;
case MAILBOX_LIST_PATH_TYPE_MAILBOX:
if (*parsed_mailbox_root_directory_prefix == '\0')
}
break;
case MAILBOX_LIST_PATH_TYPE_ALT_MAILBOX:
- if (*parsed_mailbox_root_directory_prefix == '\0')
- path = set->alt_dir;
- else if (set->alt_dir != NULL) {
- path = t_strconcat(set->alt_dir, "/",
- parsed_mailbox_root_directory_prefix, NULL);
- path = t_strndup(path, strlen(path)-1);
- }
break;
case MAILBOX_LIST_PATH_TYPE_CONTROL:
path = set->control_dir != NULL ?
const char *path = NULL;
switch (type) {
+ case MAILBOX_LIST_PATH_TYPE_ALT_DIR:
+ path = mail_set->mail_alt_path;
+ break;
+ case MAILBOX_LIST_PATH_TYPE_ALT_MAILBOX:
+ if (mail_set->mailbox_root_directory_name[0] == '\0')
+ path = mail_set->mail_alt_path;
+ else if (mail_set->mail_alt_path[0] != '\0') {
+ path = t_strconcat(mail_set->mail_alt_path, "/",
+ mail_set->mailbox_root_directory_name, NULL);
+ }
+ break;
case MAILBOX_LIST_PATH_TYPE_LIST_INDEX:
if (mail_set->parsed_list_index_dir != NULL) {
if (mail_set->parsed_list_index_dir[0] == '/') {
list->mail_set->parsed_mailbox_root_directory_prefix,
type, path_r);
}
+ if (path != NULL && path[0] == '\0')
+ path = NULL;
*path_r = path;
return path != NULL;
}
const char *index_pvt_dir;
const char *index_cache_dir;
const char *control_dir;
- const char *alt_dir; /* FIXME: dbox-specific.. */
const char *inbox_path;
/* If non-empty, it means that mails exist in a maildir_name