From: Timo Sirainen Date: Sun, 14 Feb 2010 20:30:43 +0000 (+0200) Subject: sdbox: Fixed accessing alt directories. X-Git-Tag: 2.0.beta3~88 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=686bc4ea97a86333316182865be3fcfe465a5827;p=thirdparty%2Fdovecot%2Fcore.git sdbox: Fixed accessing alt directories. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/dbox-single/sdbox-file.c b/src/lib-storage/index/dbox-single/sdbox-file.c index b5a0e5574b..15a4f9c1be 100644 --- a/src/lib-storage/index/dbox-single/sdbox-file.c +++ b/src/lib-storage/index/dbox-single/sdbox-file.c @@ -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 --git a/src/lib-storage/index/dbox-single/sdbox-storage.c b/src/lib-storage/index/dbox-single/sdbox-storage.c index 3e022744a1..3b40bd672d 100644 --- a/src/lib-storage/index/dbox-single/sdbox-storage.c +++ b/src/lib-storage/index/dbox-single/sdbox-storage.c @@ -67,9 +67,6 @@ sdbox_mailbox_alloc(struct mail_storage *storage, struct mailbox_list *list, 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 --git a/src/lib-storage/index/dbox-single/sdbox-storage.h b/src/lib-storage/index/dbox-single/sdbox-storage.h index ae671e4bf1..c32d9d4d79 100644 --- a/src/lib-storage/index/dbox-single/sdbox-storage.h +++ b/src/lib-storage/index/dbox-single/sdbox-storage.h @@ -28,7 +28,6 @@ struct sdbox_mailbox { struct sdbox_storage *storage; uint32_t hdr_ext_id; - const char *alt_path; unsigned int creating:1; unsigned int sync_rebuild:1; diff --git a/src/lib-storage/index/dbox-single/sdbox-sync-rebuild.c b/src/lib-storage/index/dbox-single/sdbox-sync-rebuild.c index 1842ec90e7..f753797561 100644 --- a/src/lib-storage/index/dbox-single/sdbox-sync-rebuild.c +++ b/src/lib-storage/index/dbox-single/sdbox-sync-rebuild.c @@ -143,13 +143,17 @@ static int 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; }