dovecot-2.0: sdbox: Fixed accessing alt directories.
dovecot at dovecot.org
dovecot at dovecot.org
Sun Feb 14 22:33:02 EET 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/3d7fb69184b3
changeset: 10710:3d7fb69184b3
user: Timo Sirainen <tss at iki.fi>
date: Sun Feb 14 22:30:43 2010 +0200
description:
sdbox: Fixed accessing alt directories.
diffstat:
src/lib-storage/index/dbox-single/sdbox-file.c | 14 +++++++++-----
src/lib-storage/index/dbox-single/sdbox-storage.c | 3 ---
src/lib-storage/index/dbox-single/sdbox-storage.h | 1 -
src/lib-storage/index/dbox-single/sdbox-sync-rebuild.c | 8 ++++++--
4 files changed, 15 insertions(+), 11 deletions(-)
diffs (74 lines):
diff -r 52e1f46fe0ba -r 3d7fb69184b3 src/lib-storage/index/dbox-single/sdbox-file.c
--- a/src/lib-storage/index/dbox-single/sdbox-file.c Sun Feb 14 21:49:40 2010 +0200
+++ b/src/lib-storage/index/dbox-single/sdbox-file.c Sun Feb 14 22:30:43 2010 +0200
@@ -10,14 +10,18 @@
static void sdbox_file_init_paths(struct sdbox_file *file, const char *fname)
{
+ struct mailbox *box = &file->mbox->box;
+ const char *alt_path;
+
i_free(file->file.primary_path);
i_free(file->file.alt_path);
file->file.primary_path =
- i_strdup_printf("%s/%s", file->mbox->box.path, fname);
- if (file->mbox->alt_path != NULL) {
- file->file.alt_path =
- i_strdup_printf("%s/%s", file->mbox->alt_path, fname);
- }
+ i_strdup_printf("%s/%s", box->path, fname);
+
+ alt_path = mailbox_list_get_path(box->list, box->name,
+ MAILBOX_LIST_PATH_TYPE_ALT_MAILBOX);
+ if (alt_path != NULL)
+ file->file.alt_path = i_strdup_printf("%s/%s", alt_path, fname);
}
struct dbox_file *sdbox_file_init(struct sdbox_mailbox *mbox, uint32_t uid)
diff -r 52e1f46fe0ba -r 3d7fb69184b3 src/lib-storage/index/dbox-single/sdbox-storage.c
--- a/src/lib-storage/index/dbox-single/sdbox-storage.c Sun Feb 14 21:49:40 2010 +0200
+++ b/src/lib-storage/index/dbox-single/sdbox-storage.c Sun Feb 14 22:30:43 2010 +0200
@@ -67,9 +67,6 @@
MAIL_INDEX_OPEN_FLAG_NEVER_IN_MEMORY;
mbox->storage = (struct sdbox_storage *)storage;
- mbox->alt_path =
- p_strconcat(pool, list->set.alt_dir, "/",
- list->set.maildir_name, NULL);
mbox->hdr_ext_id =
mail_index_ext_register(mbox->box.index, "dbox-hdr",
sizeof(struct sdbox_index_header), 0, 0);
diff -r 52e1f46fe0ba -r 3d7fb69184b3 src/lib-storage/index/dbox-single/sdbox-storage.h
--- a/src/lib-storage/index/dbox-single/sdbox-storage.h Sun Feb 14 21:49:40 2010 +0200
+++ b/src/lib-storage/index/dbox-single/sdbox-storage.h Sun Feb 14 22:30:43 2010 +0200
@@ -28,7 +28,6 @@
struct sdbox_storage *storage;
uint32_t hdr_ext_id;
- const char *alt_path;
unsigned int creating:1;
unsigned int sync_rebuild:1;
diff -r 52e1f46fe0ba -r 3d7fb69184b3 src/lib-storage/index/dbox-single/sdbox-sync-rebuild.c
--- a/src/lib-storage/index/dbox-single/sdbox-sync-rebuild.c Sun Feb 14 21:49:40 2010 +0200
+++ b/src/lib-storage/index/dbox-single/sdbox-sync-rebuild.c Sun Feb 14 22:30:43 2010 +0200
@@ -143,13 +143,17 @@
sdbox_sync_index_rebuild_singles(struct dbox_sync_rebuild_context *ctx)
{
struct sdbox_mailbox *mbox = (struct sdbox_mailbox *)ctx->box;
+ const char *alt_path;
int ret = 0;
+ alt_path = mailbox_list_get_path(ctx->box->list, ctx->box->name,
+ MAILBOX_LIST_PATH_TYPE_ALT_MAILBOX);
+
sdbox_sync_set_uidvalidity(ctx);
if (sdbox_sync_index_rebuild_dir(ctx, ctx->box->path, TRUE) < 0)
ret = -1;
- else if (mbox->alt_path != NULL)
- ret = sdbox_sync_index_rebuild_dir(ctx, mbox->alt_path, FALSE);
+ else if (alt_path != NULL)
+ ret = sdbox_sync_index_rebuild_dir(ctx, alt_path, FALSE);
sdbox_sync_update_header(ctx);
return ret;
}
More information about the dovecot-cvs
mailing list