changeset 8319:8553bb4c53ad HEAD

Fixed shared mailboxes to work with plugins.
author Timo Sirainen <tss@iki.fi>
date Thu, 23 Oct 2008 20:15:16 +0300
parents 836c8c2b87f5
children d49aa6720fb2
files src/lib-storage/index/cydir/cydir-storage.c src/lib-storage/index/dbox/dbox-storage.c src/lib-storage/index/maildir/maildir-storage.c src/lib-storage/index/mbox/mbox-storage.c src/lib-storage/index/shared/shared-storage.c src/lib-storage/mail-storage-private.h
diffstat 6 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/cydir/cydir-storage.c	Thu Oct 23 18:58:22 2008 +0300
+++ b/src/lib-storage/index/cydir/cydir-storage.c	Thu Oct 23 20:15:16 2008 +0300
@@ -68,6 +68,7 @@
 	storage = p_new(pool, struct cydir_storage, 1);
 	storage->storage = cydir_storage;
 	storage->storage.pool = pool;
+	storage->storage.storage_class = &cydir_storage;
 
 	return &storage->storage;
 }
--- a/src/lib-storage/index/dbox/dbox-storage.c	Thu Oct 23 18:58:22 2008 +0300
+++ b/src/lib-storage/index/dbox/dbox-storage.c	Thu Oct 23 20:15:16 2008 +0300
@@ -81,6 +81,7 @@
 	storage = p_new(pool, struct dbox_storage, 1);
 	storage->storage = dbox_storage;
 	storage->storage.pool = pool;
+	storage->storage.storage_class = &dbox_storage;
 
 	return &storage->storage;
 }
--- a/src/lib-storage/index/maildir/maildir-storage.c	Thu Oct 23 18:58:22 2008 +0300
+++ b/src/lib-storage/index/maildir/maildir-storage.c	Thu Oct 23 20:15:16 2008 +0300
@@ -178,6 +178,7 @@
 	storage = p_new(pool, struct maildir_storage, 1);
 	storage->storage = maildir_storage;
 	storage->storage.pool = pool;
+	storage->storage.storage_class = &maildir_storage;
 
 	return &storage->storage;
 }
--- a/src/lib-storage/index/mbox/mbox-storage.c	Thu Oct 23 18:58:22 2008 +0300
+++ b/src/lib-storage/index/mbox/mbox-storage.c	Thu Oct 23 20:15:16 2008 +0300
@@ -403,6 +403,7 @@
 	storage = p_new(pool, struct mbox_storage, 1);
 	storage->storage = mbox_storage;
 	storage->storage.pool = pool;
+	storage->storage.storage_class = &mbox_storage;
 
 	return &storage->storage;
 }
--- a/src/lib-storage/index/shared/shared-storage.c	Thu Oct 23 18:58:22 2008 +0300
+++ b/src/lib-storage/index/shared/shared-storage.c	Thu Oct 23 20:15:16 2008 +0300
@@ -24,6 +24,7 @@
 	storage = p_new(pool, struct shared_storage, 1);
 	storage->storage = shared_storage;
 	storage->storage.pool = pool;
+	storage->storage.storage_class = &shared_storage;
 
 	return &storage->storage;
 }
@@ -227,7 +228,10 @@
 	if (shared_storage_get_namespace(storage, &name, &ns) < 0)
 		return NULL;
 
-	box = mailbox_open(ns->storage, name, NULL, flags);
+	/* if we call the normal mailbox_open() here the plugins will see
+	   mailbox_open() called twice and they could break. */
+	box = ns->storage->storage_class->v.
+		mailbox_open(ns->storage, name, NULL, flags);
 	if (box == NULL)
 		shared_mailbox_copy_error(storage, ns);
 	return box;
--- a/src/lib-storage/mail-storage-private.h	Thu Oct 23 18:58:22 2008 +0300
+++ b/src/lib-storage/mail-storage-private.h	Thu Oct 23 20:15:16 2008 +0300
@@ -58,6 +58,7 @@
 	char *error_string;
 	enum mail_error error;
 
+        const struct mail_storage *storage_class;
 	struct mail_namespace *ns;
 	struct mailbox_list *list;