From: Timo Sirainen Date: Fri, 28 Aug 2009 21:01:41 +0000 (-0400) Subject: Plugins now use mail_save_context.copying instead of their own save_hacks. X-Git-Tag: 2.0.alpha1~226 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=263e4b2733768062cb0b8b8917cad78fa2a04ff9;p=thirdparty%2Fdovecot%2Fcore.git Plugins now use mail_save_context.copying instead of their own save_hacks. --HG-- branch : HEAD --- diff --git a/src/plugins/acl/acl-mailbox.c b/src/plugins/acl/acl-mailbox.c index 787d4facc0..ba1d699ba2 100644 --- a/src/plugins/acl/acl-mailbox.c +++ b/src/plugins/acl/acl-mailbox.c @@ -19,8 +19,6 @@ struct acl_mailbox { union mailbox_module_context module_ctx; struct acl_object *aclobj; - - unsigned int save_hack:1; }; struct acl_transaction_context { diff --git a/src/plugins/notify/notify-storage.c b/src/plugins/notify/notify-storage.c index 8f35dd98bc..3c78dd816f 100644 --- a/src/plugins/notify/notify-storage.c +++ b/src/plugins/notify/notify-storage.c @@ -14,7 +14,6 @@ struct notify_transaction_context { union mailbox_transaction_module_context module_ctx; struct mail *tmp_mail; - bool save_hack; }; static MODULE_CONTEXT_DEFINE_INIT(notify_storage_module, @@ -119,11 +118,7 @@ notify_copy(struct mail_save_context *ctx, struct mail *mail) ctx->dest_mail = lt->tmp_mail; } - lt->save_hack = TRUE; - ret = lbox->super.copy(ctx, mail); - lt->save_hack = FALSE; - - if (ret == 0) + if ((ret = lbox->super.copy(ctx, mail)) == 0) notify_contexts_mail_copy(mail, ctx->dest_mail); return ret; } @@ -151,11 +146,12 @@ notify_save_finish(struct mail_save_context *ctx) NOTIFY_CONTEXT(ctx->transaction); union mailbox_module_context *lbox = NOTIFY_CONTEXT(ctx->transaction->box); + struct mail *dest_mail = ctx->copying ? NULL : ctx->dest_mail; if (lbox->super.save_finish(ctx) < 0) return -1; - if (!lt->save_hack) - notify_contexts_mail_save(ctx->dest_mail); + if (dest_mail != NULL) + notify_contexts_mail_save(dest_mail); return 0; } diff --git a/src/plugins/quota/quota-storage.c b/src/plugins/quota/quota-storage.c index ba5ef926d8..aeda59c73f 100644 --- a/src/plugins/quota/quota-storage.c +++ b/src/plugins/quota/quota-storage.c @@ -31,7 +31,6 @@ struct quota_mailbox { ARRAY_DEFINE(expunge_uids, uint32_t); ARRAY_DEFINE(expunge_sizes, uoff_t); - unsigned int save_hack:1; unsigned int recalculate:1; }; @@ -172,13 +171,11 @@ quota_copy(struct mail_save_context *ctx, struct mail *mail) ctx->dest_mail = qt->tmp_mail; } - qbox->save_hack = FALSE; if (qbox->module_ctx.super.copy(ctx, mail) < 0) return -1; - /* if copying used saving internally, we already checked the quota - and set qbox->save_hack = TRUE. */ - return qbox->save_hack ? 0 : quota_check(t, ctx->dest_mail); + /* if copying used saving internally, we already checked the quota */ + return ctx->copying ? 0 : quota_check(t, ctx->dest_mail); } static int @@ -234,7 +231,6 @@ static int quota_save_finish(struct mail_save_context *ctx) if (qbox->module_ctx.super.save_finish(ctx) < 0) return -1; - qbox->save_hack = TRUE; return quota_check(ctx->transaction, ctx->dest_mail); }