This will be necessary once mailbox_list_settings is removed.
static bool
mdbox_storage_autodetect(const struct mail_namespace *ns,
struct mailbox_list_settings *set,
- const struct mail_storage_settings *mail_set ATTR_UNUSED)
+ const struct mail_storage_settings *mail_set ATTR_UNUSED,
+ const char **root_path_r,
+ const char **inbox_path_r ATTR_UNUSED)
{
struct event *event = ns->user->event;
struct stat st;
return FALSE;
}
- set->root_dir = root_dir;
+ *root_path_r = root_dir;
return TRUE;
}
static bool
sdbox_storage_autodetect(const struct mail_namespace *ns,
struct mailbox_list_settings *set,
- const struct mail_storage_settings *mail_set ATTR_UNUSED)
+ const struct mail_storage_settings *mail_set ATTR_UNUSED,
+ const char **root_path_r,
+ const char **inbox_path_r ATTR_UNUSED)
{
struct event *event = ns->user->event;
struct stat st;
return FALSE;
}
- set->root_dir = root_dir;
+ *root_path_r = root_dir;
return TRUE;
}
static bool
maildir_storage_autodetect(const struct mail_namespace *ns,
struct mailbox_list_settings *set,
- const struct mail_storage_settings *mail_set ATTR_UNUSED)
+ const struct mail_storage_settings *mail_set ATTR_UNUSED,
+ const char **root_path_r,
+ const char **inbox_path_r ATTR_UNUSED)
{
struct event *event = ns->user->event;
struct stat st;
return FALSE;
}
- set->root_dir = root_dir;
+ *root_path_r = root_dir;
return TRUE;
}
static bool
mbox_storage_autodetect(const struct mail_namespace *ns,
struct mailbox_list_settings *set,
- const struct mail_storage_settings *mail_set ATTR_UNUSED)
+ const struct mail_storage_settings *mail_set ATTR_UNUSED,
+ const char **root_path_r, const char **inbox_path_r)
{
struct event *event = ns->user->event;
const char *root_dir, *inbox_path;
if (inbox_path == NULL) {
inbox_path = mbox_storage_find_inbox_file(ns->user, event);
}
- set->root_dir = root_dir;
- set->inbox_path = inbox_path;
+ *root_path_r = root_dir;
+ *inbox_path_r = inbox_path;
return TRUE;
}
void (*get_list_settings)(const struct mail_namespace *ns,
struct mailbox_list_settings *set,
const struct mail_storage_settings *mail_set);
+ /* Returns TRUE if mailbox path could be autodetected. root_path_r
+ must be returned in that case. inbox_path_r is NULL already when
+ calling, and means the default INBOX path is used. */
bool (*autodetect)(const struct mail_namespace *ns,
struct mailbox_list_settings *set,
- const struct mail_storage_settings *mail_set);
+ const struct mail_storage_settings *mail_set,
+ const char **root_path_r, const char **inbox_path_r);
struct mailbox *(*mailbox_alloc)(struct mail_storage *storage,
struct mailbox_list *list,
const struct mail_storage_settings *mail_set)
{
struct mail_storage *const *classes;
+ const char *root_path, *inbox_path = NULL;
unsigned int i, count;
classes = array_get(&mail_storage_classes, &count);
for (i = 0; i < count; i++) {
if (classes[i]->v.autodetect != NULL) {
- if (classes[i]->v.autodetect(ns, set, mail_set))
+ if (classes[i]->v.autodetect(ns, set, mail_set,
+ &root_path, &inbox_path)) {
+ set->root_dir = root_path;
+ if (inbox_path != NULL)
+ set->inbox_path = inbox_path;
return classes[i];
+ }
}
}
return NULL;