dovecot-1.2: Fixed shared mailboxes to work with plugins.
dovecot at dovecot.org
dovecot at dovecot.org
Thu Oct 23 20:15:20 EEST 2008
details: http://hg.dovecot.org/dovecot-1.2/rev/8553bb4c53ad
changeset: 8319:8553bb4c53ad
user: Timo Sirainen <tss at iki.fi>
date: Thu Oct 23 20:15:16 2008 +0300
description:
Fixed shared mailboxes to work with plugins.
diffstat:
6 files changed, 10 insertions(+), 1 deletion(-)
src/lib-storage/index/cydir/cydir-storage.c | 1 +
src/lib-storage/index/dbox/dbox-storage.c | 1 +
src/lib-storage/index/maildir/maildir-storage.c | 1 +
src/lib-storage/index/mbox/mbox-storage.c | 1 +
src/lib-storage/index/shared/shared-storage.c | 6 +++++-
src/lib-storage/mail-storage-private.h | 1 +
diffs (78 lines):
diff -r 836c8c2b87f5 -r 8553bb4c53ad src/lib-storage/index/cydir/cydir-storage.c
--- 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 @@ static struct mail_storage *cydir_alloc(
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;
}
diff -r 836c8c2b87f5 -r 8553bb4c53ad src/lib-storage/index/dbox/dbox-storage.c
--- 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 @@ static struct mail_storage *dbox_alloc(v
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;
}
diff -r 836c8c2b87f5 -r 8553bb4c53ad src/lib-storage/index/maildir/maildir-storage.c
--- 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 @@ static struct mail_storage *maildir_allo
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;
}
diff -r 836c8c2b87f5 -r 8553bb4c53ad src/lib-storage/index/mbox/mbox-storage.c
--- 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 @@ static struct mail_storage *mbox_alloc(v
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;
}
diff -r 836c8c2b87f5 -r 8553bb4c53ad src/lib-storage/index/shared/shared-storage.c
--- 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 @@ static struct mail_storage *shared_alloc
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 @@ shared_mailbox_open(struct mail_storage
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;
diff -r 836c8c2b87f5 -r 8553bb4c53ad src/lib-storage/mail-storage-private.h
--- 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 @@ struct mail_storage {
char *error_string;
enum mail_error error;
+ const struct mail_storage *storage_class;
struct mail_namespace *ns;
struct mailbox_list *list;
More information about the dovecot-cvs
mailing list