]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Plugins now use mail_save_context.copying instead of their own save_hacks.
authorTimo Sirainen <tss@iki.fi>
Fri, 28 Aug 2009 21:01:41 +0000 (17:01 -0400)
committerTimo Sirainen <tss@iki.fi>
Fri, 28 Aug 2009 21:01:41 +0000 (17:01 -0400)
--HG--
branch : HEAD

src/plugins/acl/acl-mailbox.c
src/plugins/notify/notify-storage.c
src/plugins/quota/quota-storage.c

index 787d4facc09173a5f18b19da522eae2c2f818a3a..ba1d699ba2efc8cf9e33d3d1ed06ffefdfb536f5 100644 (file)
@@ -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 {
index 8f35dd98bc9e2ecaf8e11ff49c29000eb840007b..3c78dd816f496f3319347504e36b4f86156b57a8 100644 (file)
@@ -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;
 }
 
index ba5ef926d894e0220c447e476255f2b4d9358228..aeda59c73fcf1a4225ea1d1e436cb74582301ada 100644 (file)
@@ -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);
 }