dovecot-2.2: lib-storage: mailbox_list_index=yes was broken by p...

dovecot at dovecot.org dovecot at dovecot.org
Thu Apr 11 19:06:39 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/cf898dbcbffb
changeset: 16282:cf898dbcbffb
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Apr 11 19:06:25 2013 +0300
description:
lib-storage: mailbox_list_index=yes was broken by previous change.
Reverted the previous change and fixed it the right way.

diffstat:

 src/lib-storage/list/mailbox-list-index.c |  48 ++++++++++--------------------
 1 files changed, 16 insertions(+), 32 deletions(-)

diffs (78 lines):

diff -r 7a7fa88aafe7 -r cf898dbcbffb src/lib-storage/list/mailbox-list-index.c
--- a/src/lib-storage/list/mailbox-list-index.c	Thu Apr 11 18:50:25 2013 +0300
+++ b/src/lib-storage/list/mailbox-list-index.c	Thu Apr 11 19:06:25 2013 +0300
@@ -536,8 +536,9 @@
 	return 0;
 }
 
-static void mailbox_list_index_created_last(struct mailbox_list *list)
+static void mailbox_list_index_created(struct mailbox_list *list)
 {
+	struct mailbox_list_vfuncs *v = list->vlast;
 	struct mailbox_list_index *ilist;
 	bool has_backing_store;
 
@@ -555,24 +556,25 @@
 	}
 
 	ilist = p_new(list->pool, struct mailbox_list_index, 1);
-	ilist->module_ctx.super = list->v;
+	ilist->module_ctx.super = *v;
+	list->vlast = &ilist->module_ctx.super;
 	ilist->has_backing_store = has_backing_store;
 	ilist->pending_init = TRUE;
 
-	list->v.deinit = mailbox_list_index_deinit;
-	list->v.iter_init = mailbox_list_index_iter_init;
-	list->v.iter_deinit = mailbox_list_index_iter_deinit;
-	list->v.iter_next = mailbox_list_index_iter_next;
+	v->deinit = mailbox_list_index_deinit;
+	v->iter_init = mailbox_list_index_iter_init;
+	v->iter_deinit = mailbox_list_index_iter_deinit;
+	v->iter_next = mailbox_list_index_iter_next;
 
-	list->v.delete_mailbox = mailbox_list_index_delete_mailbox;
-	list->v.delete_dir = mailbox_list_index_delete_dir;
-	list->v.rename_mailbox = mailbox_list_index_rename_mailbox;
-	list->v.set_subscribed = mailbox_list_index_set_subscribed;
+	v->delete_mailbox = mailbox_list_index_delete_mailbox;
+	v->delete_dir = mailbox_list_index_delete_dir;
+	v->rename_mailbox = mailbox_list_index_rename_mailbox;
+	v->set_subscribed = mailbox_list_index_set_subscribed;
 
-	list->v.notify_init = mailbox_list_index_notify_init;
-	list->v.notify_next = mailbox_list_index_notify_next;
-	list->v.notify_deinit = mailbox_list_index_notify_deinit;
-	list->v.notify_wait = mailbox_list_index_notify_wait;
+	v->notify_init = mailbox_list_index_notify_init;
+	v->notify_next = mailbox_list_index_notify_next;
+	v->notify_deinit = mailbox_list_index_notify_deinit;
+	v->notify_wait = mailbox_list_index_notify_wait;
 
 	MODULE_CONTEXT_SET(list, mailbox_list_index_module, ilist);
 }
@@ -643,24 +645,6 @@
 	mailbox_list_index_backend_init_mailbox(box);
 }
 
-static struct mail_storage_hooks mailbox_list_index_hooks_last = {
-	.mailbox_list_created = mailbox_list_index_created_last
-};
-static bool mailbox_list_index_hooks_last_added = FALSE;
-
-static void mailbox_list_index_created(struct mailbox_list *list ATTR_UNUSED)
-{
-	/* We want our mailbox list index hooks to be called just before the
-	   backend methods are called. Most importantly the ACL plugin's hooks
-	   must be called before us, otherwise we'll end up skipping them and
-	   showing all the mailboxes. So we do this dual-registration where
-	   this second one gets us into the correct position. */
-	if (!mailbox_list_index_hooks_last_added) {
-		mailbox_list_index_hooks_last_added = TRUE;
-		mail_storage_hooks_add_internal(&mailbox_list_index_hooks_last);
-	}
-}
-
 static struct mail_storage_hooks mailbox_list_index_hooks = {
 	.mailbox_list_created = mailbox_list_index_created,
 	.mail_namespaces_added = mailbox_list_index_namespaces_added,


More information about the dovecot-cvs mailing list