struct shared_storage *storage = SHARED_STORAGE(_storage);
struct mail_user *user = _storage->user;
struct mail_namespace *new_ns, *ns = *_ns;
- struct mail_namespace_settings *ns_set, *unexpanded_ns_set;
+ struct mail_namespace_settings *ns_set;
struct mail_user *owner;
const char *domain = NULL, *username = NULL, *userdomain = NULL;
const char *name, *p, *next, **dest, *error;
ns_set->separator = p_strdup_printf(user->pool, "%c", ns_sep);
ns_set->prefix = new_ns->prefix;
ns_set->location = p_strdup(user->pool, str_c(location));
+ ns_set->unexpanded_location =
+ p_strdup(user->pool, storage->unexpanded_location);
ns_set->hidden = TRUE;
ns_set->list = "yes";
new_ns->set = ns_set;
- unexpanded_ns_set =
- p_new(user->pool, struct mail_namespace_settings, 1);
- *unexpanded_ns_set = *ns_set;
- unexpanded_ns_set->location =
- p_strdup(user->pool, storage->unexpanded_location);
- new_ns->unexpanded_set = unexpanded_ns_set;
-
/* We need to create a prefix="" namespace for the owner */
if (mail_namespaces_init_location(owner, str_c(location), &error) < 0) {
/* owner gets freed by namespace deinit */
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,
const char **error_r)
{
ns->user = user;
ns->prefix = i_strdup(ns_set->prefix);
ns->set = ns_set;
- ns->unexpanded_set = unexpanded_set;
ns->user_set = user_all_settings;
ns->mail_set = mail_user_set_get_driver_settings(user->set_parser,
user->set_info, ns->user_set, &mail_storage_setting_parser_info);
int mail_namespaces_init_add(struct mail_user *user,
struct mail_namespace_settings *ns_set,
- struct mail_namespace_settings *unexpanded_ns_set,
struct mail_namespace **ns_p, const char **error_r)
{
const struct mail_storage_settings *mail_set =
ns_set->subscriptions ? "yes" : "no", ns_set->location);
if ((ret = mail_namespace_alloc(user, user->set,
- ns_set, unexpanded_ns_set,
- &ns, error_r)) < 0)
+ ns_set, &ns, error_r)) < 0)
return ret;
if (ns_set == &prefixless_ns_set) {
if (mail_namespaces_init_add(namespaces->user,
&prefixless_ns_set,
- &prefixless_ns_unexpanded_set,
&ns, error_r) < 0)
i_unreached();
ns->next = namespaces;
int mail_namespaces_init(struct mail_user *user, const char **error_r)
{
struct mail_namespace_settings *const *ns_set;
- struct mail_namespace_settings *const *unexpanded_ns_set;
struct mail_namespace *namespaces, **ns_p;
- unsigned int i, count, count2;
+ unsigned int i, count;
i_assert(user->initialized);
namespaces = NULL; ns_p = &namespaces;
- if (array_is_created(&user->set->namespaces)) {
+ if (array_is_created(&user->set->namespaces))
ns_set = array_get(&user->set->namespaces, &count);
- unexpanded_ns_set =
- array_get(&user->unexpanded_set->namespaces, &count2);
- i_assert(count == count2);
- } else {
- ns_set = unexpanded_ns_set = NULL;
+ else {
+ ns_set = NULL;
count = 0;
}
for (i = 0; i < count; i++) {
continue;
if (mail_namespaces_init_add(user, ns_set[i],
- unexpanded_ns_set[i],
ns_p, error_r) < 0) {
if (!ns_set[i]->ignore_on_failure) {
mail_namespaces_deinit(&namespaces);
int mail_namespaces_init_location(struct mail_user *user, const char *location,
const char **error_r)
{
- struct mail_namespace_settings *inbox_set, *unexpanded_inbox_set;
+ struct mail_namespace_settings *inbox_set;
struct mail_namespace *ns;
const struct mail_storage_settings *mail_set;
const char *error, *driver, *location_source;
inbox_set->type = "private";
inbox_set->list = "yes";
- unexpanded_inbox_set = p_new(user->pool, struct mail_namespace_settings, 1);
- *unexpanded_inbox_set = *inbox_set;
-
driver = NULL;
mail_set = mail_user_set_get_storage_set(user);
if (location != NULL) {
/* treat this the same as if a namespace was created with
default settings. dsync relies on finding a namespace
without explicit location setting. */
- unexpanded_inbox_set->location = SETTING_STRVAR_UNEXPANDED;
+ inbox_set->unexpanded_location = SETTING_STRVAR_UNEXPANDED;
} else {
- unexpanded_inbox_set->location =
+ inbox_set->unexpanded_location =
p_strconcat(user->pool, SETTING_STRVAR_EXPANDED,
inbox_set->location, NULL);
}
if ((ret = mail_namespace_alloc(user, user->set,
- inbox_set, unexpanded_inbox_set,
- &ns, error_r)) < 0)
+ inbox_set, &ns, error_r)) < 0)
return ret;
if (mail_storage_create(ns, driver, 0, &error) < 0) {
mail_user. */
struct mail_user_settings *user_set;
- const struct mail_namespace_settings *set, *unexpanded_set;
+ const struct mail_namespace_settings *set;
const struct mail_storage_settings *mail_set;
bool special_use_mailboxes:1;
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,
const char **error_r);
mail_namespaces_init(). */
int mail_namespaces_init_add(struct mail_user *user,
struct mail_namespace_settings *ns_set,
- struct mail_namespace_settings *unexpanded_ns_set,
struct mail_namespace **ns_p, const char **error_r);
int mail_namespaces_init_finish(struct mail_namespace *namespaces,
const char **error_r);