Mercurial > dovecot > core-2.2
changeset 21665:5aef15cec9aa
lib-lda: Refactor - Add struct mail_deliver_mailbox
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Tue, 21 Feb 2017 12:34:59 +0200 |
parents | 1cfecca4693d |
children | b68299be012a |
files | src/lib-lda/mail-deliver.c |
diffstat | 1 files changed, 13 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-lda/mail-deliver.c Tue Feb 21 19:55:48 2017 +0200 +++ b/src/lib-lda/mail-deliver.c Tue Feb 21 12:34:59 2017 +0200 @@ -41,6 +41,10 @@ uoff_t psize, vsize; }; +struct mail_deliver_mailbox { + union mailbox_module_context module_ctx; +}; + static const char *lda_log_wanted_headers[] = { "From", "Message-ID", "Subject", NULL @@ -508,11 +512,11 @@ static int mail_deliver_save_finish(struct mail_save_context *ctx) { struct mailbox *box = ctx->transaction->box; - union mailbox_module_context *mbox = MAIL_DELIVER_STORAGE_CONTEXT(box); + struct mail_deliver_mailbox *mbox = MAIL_DELIVER_STORAGE_CONTEXT(box); struct mail_deliver_user *muser = MAIL_DELIVER_USER_CONTEXT(box->storage->user); - if (mbox->super.save_finish(ctx) < 0) + if (mbox->module_ctx.super.save_finish(ctx) < 0) return -1; /* initialize most of the fields from dest_mail */ @@ -523,11 +527,11 @@ static int mail_deliver_copy(struct mail_save_context *ctx, struct mail *mail) { struct mailbox *box = ctx->transaction->box; - union mailbox_module_context *mbox = MAIL_DELIVER_STORAGE_CONTEXT(box); + struct mail_deliver_mailbox *mbox = MAIL_DELIVER_STORAGE_CONTEXT(box); struct mail_deliver_user *muser = MAIL_DELIVER_USER_CONTEXT(box->storage->user); - if (mbox->super.copy(ctx, mail) < 0) + if (mbox->module_ctx.super.copy(ctx, mail) < 0) return -1; /* initialize most of the fields from dest_mail */ @@ -598,7 +602,7 @@ static void mail_deliver_mailbox_allocated(struct mailbox *box) { struct mailbox_vfuncs *v = box->vlast; - union mailbox_module_context *mbox; + struct mail_deliver_mailbox *mbox; struct mail_deliver_user *muser = MAIL_DELIVER_USER_CONTEXT(box->storage->user); @@ -607,14 +611,14 @@ if (muser->deliver_ctx == NULL) return; - mbox = p_new(box->pool, union mailbox_module_context, 1); - mbox->super = *v; - box->vlast = &mbox->super; + mbox = p_new(box->pool, struct mail_deliver_mailbox, 1); + mbox->module_ctx.super = *v; + box->vlast = &mbox->module_ctx.super; v->save_finish = mail_deliver_save_finish; v->copy = mail_deliver_copy; v->transaction_commit = mail_deliver_transaction_commit; - MODULE_CONTEXT_SET_SELF(box, mail_deliver_storage_module, mbox); + MODULE_CONTEXT_SET(box, mail_deliver_storage_module, mbox); } static struct mail_storage_hooks mail_deliver_hooks = {