]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Add mailbox_list_lost_mailbox_prefix hidden setting
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 11 Nov 2024 20:49:21 +0000 (22:49 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 17 Jan 2025 08:40:00 +0000 (10:40 +0200)
This replaces mail_storage.lost_mailbox_prefix.

src/lib-storage/list/mail-storage-list-index-rebuild.c
src/lib-storage/mail-storage-private.h
src/lib-storage/mail-storage-settings.c
src/lib-storage/mail-storage-settings.h
src/lib-storage/mail-storage.c

index dec4089ea1c6ae0ab4509075fabff703eeeee33a..d740c8c77a844d9ef05e7364b2d7110e12972564 100644 (file)
@@ -153,8 +153,8 @@ static const char *get_box_name(struct mail_storage_list_index_rebuild_ctx *ctx,
                                             "but could not recover mailbox name",
                        guid_128_to_string(box->guid), path);
                box_name = t_strdup_printf("%s%s",
-                                          ctx->storage->lost_mailbox_prefix,
-                                          guid_128_to_string(box->guid));
+                       ctx->storage->set->mailbox_list_lost_mailbox_prefix,
+                       guid_128_to_string(box->guid));
        }
        return box_name;
 }
@@ -211,8 +211,8 @@ mail_storage_list_remove_duplicate(struct mail_storage_list_index_rebuild_ctx *c
        }
        /* we'll need to delete one of these entries. if one of them begins with
           "lost-", remove it. otherwise just pick one of them randomly. */
-       if (strncmp(box->name, ctx->storage->lost_mailbox_prefix,
-                   strlen(ctx->storage->lost_mailbox_prefix)) == 0) {
+       if (strncmp(box->name, ctx->storage->set->mailbox_list_lost_mailbox_prefix,
+                   strlen(ctx->storage->set->mailbox_list_lost_mailbox_prefix)) == 0) {
                delete_name = box->name;
                keep_name = rebuild_box->index_name;
        } else {
index 592d3cfdd10d63142aa1b0dc76d116d067b2d614..6732bd80e4d09dd427ddb5ca4750f39a14f92d90 100644 (file)
@@ -25,8 +25,6 @@ struct fs;
 
 #define MAIL_SHARED_STORAGE_NAME "shared"
 
-#define MAIL_STORAGE_LOST_MAILBOX_PREFIX "recovered-lost-folder-"
-
 enum mail_storage_list_index_rebuild_reason {
        /* Mailbox list index was found to be corrupted. */
        MAIL_STORAGE_LIST_INDEX_REBUILD_REASON_CORRUPTED,
@@ -166,9 +164,6 @@ struct mail_storage {
         * uniqueness checking (via strcmp) and never used as a path. */
        const char *unique_root_dir;
 
-       /* prefix for lost mailbox */
-       const char *lost_mailbox_prefix;
-
        /* Last error set in mail_storage_set_critical(). */
        char *last_internal_error;
        char *last_internal_error_mailbox;
index 0680c821e3e4cdf4998e08b0cd9312e498d58081..d568aca8bd14ed329d9a55b00336a9598e9c5b4e 100644 (file)
@@ -86,6 +86,7 @@ static const struct setting_define mail_storage_setting_defines[] = {
        DEF(BOOL_HIDDEN, mailbox_list_utf8),
        DEF(STR, mailbox_list_visible_escape_char),
        DEF(STR, mailbox_list_storage_escape_char),
+       DEF(STR_HIDDEN, mailbox_list_lost_mailbox_prefix),
        DEF(STR_HIDDEN, mailbox_directory_name),
        DEF(BOOL, mailbox_directory_name_legacy),
        DEF(STR_HIDDEN, mailbox_root_directory_name),
@@ -165,6 +166,7 @@ const struct mail_storage_settings mail_storage_default_settings = {
        .mailbox_list_utf8 = FALSE,
        .mailbox_list_visible_escape_char = "",
        .mailbox_list_storage_escape_char = "",
+       .mailbox_list_lost_mailbox_prefix = "recovered-lost-folder-",
        .mailbox_directory_name = "",
        .mailbox_directory_name_legacy = TRUE,
        .mailbox_root_directory_name = "",
index f4a1ba20c7028a1008a9d5d6bc9cef10b00a31a2..8ad2960f2f1a106bddda58ba062928f13f73709c 100644 (file)
@@ -67,6 +67,7 @@ struct mail_storage_settings {
        bool mailbox_list_utf8;
        const char *mailbox_list_visible_escape_char;
        const char *mailbox_list_storage_escape_char;
+       const char *mailbox_list_lost_mailbox_prefix;
        const char *mailbox_directory_name;
        bool mailbox_directory_name_legacy;
        const char *mailbox_root_directory_name;
index 99bae4536ada222732566bc238ae5f8435a25969..7149217872600ecf9cd65b2a81cb89dcda250ec0 100644 (file)
@@ -492,8 +492,6 @@ mail_storage_create_real(struct mail_namespace *ns, struct event *set_event,
        }
 
        storage = storage_class->v.alloc();
-       if (storage->lost_mailbox_prefix == NULL)
-               storage->lost_mailbox_prefix = MAIL_STORAGE_LOST_MAILBOX_PREFIX;
        storage->refcount = 1;
        storage->storage_class = storage_class;
        storage->user = ns->user;