]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
sdbox: Fixed accessing alt directories.
authorTimo Sirainen <tss@iki.fi>
Sun, 14 Feb 2010 20:30:43 +0000 (22:30 +0200)
committerTimo Sirainen <tss@iki.fi>
Sun, 14 Feb 2010 20:30:43 +0000 (22:30 +0200)
--HG--
branch : HEAD

src/lib-storage/index/dbox-single/sdbox-file.c
src/lib-storage/index/dbox-single/sdbox-storage.c
src/lib-storage/index/dbox-single/sdbox-storage.h
src/lib-storage/index/dbox-single/sdbox-sync-rebuild.c

index b5a0e5574b7b4354f9ca93e6376404e833c95d65..15a4f9c1bef6a5558d6dd57204c58a5b8df97db7 100644 (file)
 
 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)
index 3e022744a1ce969cbefc0f0c6e83faeb7fb7ef4a..3b40bd672dbddef178e4a57639353599ab1f4e21 100644 (file)
@@ -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);
index ae671e4bf1ef5a820472a2cf2d6f08f49ca4b429..c32d9d4d79cd4dfc1aefa85bbdec723b812e7564 100644 (file)
@@ -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;
index 1842ec90e7b3efda6d9e77cbff72e681909932b3..f7537975614ff2c6044f80c9d75a5b4d6f4d1974 100644 (file)
@@ -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;
 }