From: Timo Sirainen Date: Mon, 19 Jan 2009 01:15:26 +0000 (-0500) Subject: hook_mail_namespaces_created() wasn't always called with all namespaces as parameter. X-Git-Tag: 1.2.beta1~91 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=94ce7e7700cda14a8342cb08e7285507b4b531da;p=thirdparty%2Fdovecot%2Fcore.git hook_mail_namespaces_created() wasn't always called with all namespaces as parameter. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/shared/shared-storage.c b/src/lib-storage/index/shared/shared-storage.c index 927c49bcfd..c736ac9420 100644 --- a/src/lib-storage/index/shared/shared-storage.c +++ b/src/lib-storage/index/shared/shared-storage.c @@ -243,11 +243,11 @@ int shared_storage_get_namespace(struct mail_storage *_storage, mail_namespace_destroy(ns); return -1; } - mail_user_add_namespace(user, ns); _storage->ns->flags |= NAMESPACE_FLAG_USABLE; - *_name = mail_namespace_fix_sep(ns, name); *ns_r = ns; + + mail_user_add_namespace(user, &ns); return 0; } diff --git a/src/lib-storage/mail-namespace.c b/src/lib-storage/mail-namespace.c index 6c8392687d..657732bc06 100644 --- a/src/lib-storage/mail-namespace.c +++ b/src/lib-storage/mail-namespace.c @@ -244,7 +244,7 @@ int mail_namespaces_init(struct mail_user *user) } return -1; } - mail_user_add_namespace(user, namespaces); + mail_user_add_namespace(user, &namespaces); if (hook_mail_namespaces_created != NULL) { T_BEGIN { diff --git a/src/lib-storage/mail-user.c b/src/lib-storage/mail-user.c index 150e47380c..adb3290712 100644 --- a/src/lib-storage/mail-user.c +++ b/src/lib-storage/mail-user.c @@ -75,9 +75,10 @@ void mail_user_set_home(struct mail_user *user, const char *home) user->home_looked_up = TRUE; } -void mail_user_add_namespace(struct mail_user *user, struct mail_namespace *ns) +void mail_user_add_namespace(struct mail_user *user, + struct mail_namespace **namespaces) { - struct mail_namespace **tmp, *next; + struct mail_namespace **tmp, *next, *ns = *namespaces; for (; ns != NULL; ns = next) { next = ns->next; @@ -90,6 +91,7 @@ void mail_user_add_namespace(struct mail_user *user, struct mail_namespace *ns) ns->next = *tmp; *tmp = ns; } + *namespaces = user->namespaces; } void mail_user_drop_useless_namespaces(struct mail_user *user) diff --git a/src/lib-storage/mail-user.h b/src/lib-storage/mail-user.h index d4379e5603..15903a5f59 100644 --- a/src/lib-storage/mail-user.h +++ b/src/lib-storage/mail-user.h @@ -60,8 +60,10 @@ void mail_user_set_home(struct mail_user *user, const char *home); has no home directory) or -1 if lookup failed. */ int mail_user_get_home(struct mail_user *user, const char **home_r); -/* Add a new namespace to user's namespaces. */ -void mail_user_add_namespace(struct mail_user *user, struct mail_namespace *ns); +/* Add more namespaces to user's namespaces. The ->next pointers may be + changed, so the namespaces pointer will be updated to user->namespaces. */ +void mail_user_add_namespace(struct mail_user *user, + struct mail_namespace **namespaces); /* Drop autocreated shared namespaces that don't have any "usable" mailboxes. */ void mail_user_drop_useless_namespaces(struct mail_user *user);