dovecot-1.2: hook_mail_namespaces_created() wasn't always called...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jan 19 03:15:34 EET 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/8b3af54b4dc3
changeset: 8652:8b3af54b4dc3
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Jan 18 20:15:26 2009 -0500
description:
hook_mail_namespaces_created() wasn't always called with all namespaces as parameter.

diffstat:

4 files changed, 11 insertions(+), 7 deletions(-)
src/lib-storage/index/shared/shared-storage.c |    4 ++--
src/lib-storage/mail-namespace.c              |    2 +-
src/lib-storage/mail-user.c                   |    6 ++++--
src/lib-storage/mail-user.h                   |    6 ++++--

diffs (69 lines):

diff -r a498c440eef2 -r 8b3af54b4dc3 src/lib-storage/index/shared/shared-storage.c
--- a/src/lib-storage/index/shared/shared-storage.c	Sun Jan 18 20:14:31 2009 -0500
+++ b/src/lib-storage/index/shared/shared-storage.c	Sun Jan 18 20:15:26 2009 -0500
@@ -243,11 +243,11 @@ int shared_storage_get_namespace(struct 
 		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 -r a498c440eef2 -r 8b3af54b4dc3 src/lib-storage/mail-namespace.c
--- a/src/lib-storage/mail-namespace.c	Sun Jan 18 20:14:31 2009 -0500
+++ b/src/lib-storage/mail-namespace.c	Sun Jan 18 20:15:26 2009 -0500
@@ -244,7 +244,7 @@ int mail_namespaces_init(struct mail_use
 			}
 			return -1;
 		}
-		mail_user_add_namespace(user, namespaces);
+		mail_user_add_namespace(user, &namespaces);
 
 		if (hook_mail_namespaces_created != NULL) {
 			T_BEGIN {
diff -r a498c440eef2 -r 8b3af54b4dc3 src/lib-storage/mail-user.c
--- a/src/lib-storage/mail-user.c	Sun Jan 18 20:14:31 2009 -0500
+++ b/src/lib-storage/mail-user.c	Sun Jan 18 20:15:26 2009 -0500
@@ -75,9 +75,10 @@ void mail_user_set_home(struct mail_user
 	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
 		ns->next = *tmp;
 		*tmp = ns;
 	}
+	*namespaces = user->namespaces;
 }
 
 void mail_user_drop_useless_namespaces(struct mail_user *user)
diff -r a498c440eef2 -r 8b3af54b4dc3 src/lib-storage/mail-user.h
--- a/src/lib-storage/mail-user.h	Sun Jan 18 20:14:31 2009 -0500
+++ b/src/lib-storage/mail-user.h	Sun Jan 18 20:15:26 2009 -0500
@@ -60,8 +60,10 @@ void mail_user_set_home(struct mail_user
    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);
 


More information about the dovecot-cvs mailing list