}
int mail_namespace_alloc(struct mail_user *user,
+ void *user_all_settings,
struct mail_namespace_settings *ns_set,
struct mail_namespace_settings *unexpanded_set,
struct mail_namespace **ns_r,
ns->prefix = i_strdup(ns_set->prefix);
ns->set = ns_set;
ns->unexpanded_set = unexpanded_set;
- ns->mail_set = mail_user_set_get_storage_set(user);
+ ns->user_set = user_all_settings;
+ ns->mail_set = mail_user_set_get_driver_settings(user->set_info,
+ ns->user_set, MAIL_STORAGE_SET_DRIVER_NAME);
i_array_init(&ns->all_storages, 2);
if (strcmp(ns_set->type, "private") == 0) {
ns_set->subscriptions ? "yes" : "no", ns_set->location);
}
- if ((ret = mail_namespace_alloc(user, ns_set, unexpanded_ns_set,
+ if ((ret = mail_namespace_alloc(user, user->set,
+ ns_set, unexpanded_ns_set,
&ns, error_r)) < 0)
return ret;
inbox_set->location, NULL);
}
- if ((ret = mail_namespace_alloc(user, inbox_set, unexpanded_inbox_set,
+ if ((ret = mail_namespace_alloc(user, user->set,
+ inbox_set, unexpanded_inbox_set,
&ns, error_r)) < 0)
return ret;
ns->prefix = i_strdup("");
ns->flags = NAMESPACE_FLAG_INBOX_USER | NAMESPACE_FLAG_INBOX_ANY |
NAMESPACE_FLAG_LIST_PREFIX | NAMESPACE_FLAG_SUBSCRIPTIONS;
+ ns->user_set = user->set;
ns->mail_set = mail_user_set_get_storage_set(user);
i_array_init(&ns->all_storages, 2);
user->namespaces = ns;
struct mail_storage *storage; /* default storage */
ARRAY(struct mail_storage *) all_storages;
+ /* This may point to user->set, but it may also point to
+ namespace-specific settings. When accessing namespace-specific
+ settings it should be done through here instead of through the
+ mail_user. */
+ struct mail_user_settings *user_set;
+
const struct mail_namespace_settings *set, *unexpanded_set;
const struct mail_storage_settings *mail_set;
/* Allocate a new namespace, and fill it based on the passed in settings.
This is the most low-level namespace creation function. The storage isn't
- initialized for the namespace. */
+ initialized for the namespace.
+
+ user_all_settings normally points to user->set. If you want to override
+ settings for the created namespace, you can duplicate the user's settings
+ and provide a pointer to it here. Note that the pointer must contain
+ ALL the settings, including the dynamic driver-specific settings, so it
+ needs to created via settings-parser API. */
int mail_namespace_alloc(struct mail_user *user,
+ void *user_all_settings,
struct mail_namespace_settings *ns_set,
struct mail_namespace_settings *unexpanded_set,
struct mail_namespace **ns_r,