Mercurial > dovecot > core-2.2
changeset 21149:1051201a6936
lib-storage: Use mail_namespace_alloc() for mail_namespaces_init_location()
Based on patch by Jeff Sipek
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Mon, 14 Nov 2016 18:34:02 +0100 |
parents | 04894c6f4fb2 |
children | 9ca422be9f71 |
files | src/lib-storage/mail-namespace.c |
diffstat | 1 files changed, 4 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/mail-namespace.c Mon Nov 14 18:33:37 2016 +0100 +++ b/src/lib-storage/mail-namespace.c Mon Nov 14 18:34:02 2016 +0100 @@ -436,17 +436,10 @@ const struct mail_storage_settings *mail_set; const char *error, *driver, *location_source; bool default_location = FALSE; + int ret; i_assert(location == NULL || *location != '\0'); - ns = i_new(struct mail_namespace, 1); - ns->refcount = 1; - ns->type = MAIL_NAMESPACE_TYPE_PRIVATE; - ns->flags = NAMESPACE_FLAG_INBOX_USER | NAMESPACE_FLAG_INBOX_ANY | - NAMESPACE_FLAG_LIST_PREFIX | NAMESPACE_FLAG_SUBSCRIPTIONS; - ns->owner = user; - i_array_init(&ns->all_storages, 2); - inbox_set = p_new(user->pool, struct mail_namespace_settings, 1); *inbox_set = mail_namespace_default_settings; inbox_set->inbox = TRUE; @@ -491,11 +484,9 @@ inbox_set->location, NULL); } - ns->set = inbox_set; - ns->unexpanded_set = unexpanded_inbox_set; - ns->mail_set = mail_set; - ns->prefix = i_strdup(""); - ns->user = user; + if ((ret = mail_namespace_alloc(user, inbox_set, unexpanded_inbox_set, + &ns, error_r)) < 0) + return ret; if (mail_storage_create(ns, driver, 0, &error) < 0) { if (*inbox_set->location != '\0') {