]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
hook_mail_namespaces_created() wasn't always called with all namespaces as parameter.
authorTimo Sirainen <tss@iki.fi>
Mon, 19 Jan 2009 01:15:26 +0000 (20:15 -0500)
committerTimo Sirainen <tss@iki.fi>
Mon, 19 Jan 2009 01:15:26 +0000 (20:15 -0500)
--HG--
branch : HEAD

src/lib-storage/index/shared/shared-storage.c
src/lib-storage/mail-namespace.c
src/lib-storage/mail-user.c
src/lib-storage/mail-user.h

index 927c49bcfd5f8784b8c422ee8aa01ba7d3ddd617..c736ac94207cf9fce5080e49269a1646f75409d7 100644 (file)
@@ -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;
 }
 
index 6c8392687d96d19d134e51ba3f166688e6c5d0f2..657732bc065a9371551451cfb2107f330f7b2f34 100644 (file)
@@ -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 {
index 150e47380c7a6a4c6928c5adb3359908b59dcad8..adb3290712311089e12b48158f9248792a539e20 100644 (file)
@@ -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)
index d4379e560367a07a151287afd11193454098a74e..15903a5f5915336f5d416fde855c564eaa940cb0 100644 (file)
@@ -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);