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)
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);
struct sdbox_storage *storage;
uint32_t hdr_ext_id;
- const char *alt_path;
unsigned int creating:1;
unsigned int sync_rebuild:1;
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;
}