]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
fts: storage - Add fts_settings to struct fts_mailbox
authorMarco Bettini <marco.bettini@open-xchange.com>
Wed, 17 Jan 2024 15:18:15 +0000 (15:18 +0000)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:11 +0000 (12:34 +0200)
src/plugins/fts/fts-storage.c
src/plugins/fts/fts-storage.h

index d041409d58f9342d092742f3ddbd6b50de47660c..1a2fe2ff54554464a1147fed64ecdc818848f2be 100644 (file)
@@ -46,6 +46,7 @@ struct fts_mailbox_list {
 
 struct fts_mailbox {
        union mailbox_module_context module_ctx;
+       const struct fts_settings *set;
        struct fts_backend_update_context *sync_update_ctx;
        bool fts_mailbox_excluded;
 };
@@ -818,6 +819,13 @@ static int fts_mailbox_search_next_match_mail(struct mail_search_context *ctx,
        return fbox->module_ctx.super.search_next_match_mail(ctx, mail);
 }
 
+static void fts_mailbox_free(struct mailbox *box)
+{
+       struct fts_mailbox *fbox = FTS_CONTEXT_REQUIRE(box);
+       settings_free(fbox->set);
+       fbox->module_ctx.super.free(box);
+}
+
 void fts_mailbox_allocated(struct mailbox *box)
 {
        struct fts_mailbox_list *flist = FTS_LIST_CONTEXT(box->list);
@@ -827,8 +835,17 @@ void fts_mailbox_allocated(struct mailbox *box)
        if (flist == NULL || flist->failed)
                return;
 
+       const struct fts_settings *set;
+       const char *error;
+       if (settings_get(box->event, &fts_setting_parser_info, 0, &set, &error) < 0) {
+               e_error(box->event, "%s", error);
+               return;
+       }
+
        fbox = p_new(box->pool, struct fts_mailbox, 1);
        fbox->module_ctx.super = *v;
+       v->free = fts_mailbox_free;
+       fbox->set = set;
        box->vlast = &fbox->module_ctx.super;
        fbox->fts_mailbox_excluded = fts_user_autoindex_exclude(box);
 
@@ -932,3 +949,9 @@ struct fts_backend *fts_list_backend(struct mailbox_list *list)
 
        return flist == NULL ? NULL : flist->backend;
 }
+
+const struct fts_settings *fts_mailbox_get_settings(struct mailbox *box)
+{
+       struct fts_mailbox *fbox = FTS_CONTEXT_REQUIRE(box);
+       return fbox->set;
+}
index dad0b826429a2f99a3e6240753c6f6f643f5b1ce..2479ea11aa925e5612b8c6cde0c0beda657276ec 100644 (file)
@@ -70,4 +70,6 @@ void fts_mailbox_list_created(struct mailbox_list *list);
 int fts_mailbox_get_status(struct mailbox *box, enum mailbox_status_items items,
                           struct mailbox_status *status_r);
 
+const struct fts_settings *fts_mailbox_get_settings(struct mailbox *box);
+
 #endif