dovecot-2.0: Plugins now use mail_save_context.copying instead o...
dovecot at dovecot.org
dovecot at dovecot.org
Sat Aug 29 00:01:46 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/63b7223cce4b
changeset: 9826:63b7223cce4b
user: Timo Sirainen <tss at iki.fi>
date: Fri Aug 28 17:01:41 2009 -0400
description:
Plugins now use mail_save_context.copying instead of their own save_hacks.
diffstat:
3 files changed, 6 insertions(+), 16 deletions(-)
src/plugins/acl/acl-mailbox.c | 2 --
src/plugins/notify/notify-storage.c | 12 ++++--------
src/plugins/quota/quota-storage.c | 8 ++------
diffs (86 lines):
diff -r 9f5bbc4780a1 -r 63b7223cce4b src/plugins/acl/acl-mailbox.c
--- a/src/plugins/acl/acl-mailbox.c Fri Aug 28 17:01:26 2009 -0400
+++ b/src/plugins/acl/acl-mailbox.c Fri Aug 28 17:01:41 2009 -0400
@@ -19,8 +19,6 @@ struct acl_mailbox {
struct acl_mailbox {
union mailbox_module_context module_ctx;
struct acl_object *aclobj;
-
- unsigned int save_hack:1;
};
struct acl_transaction_context {
diff -r 9f5bbc4780a1 -r 63b7223cce4b src/plugins/notify/notify-storage.c
--- a/src/plugins/notify/notify-storage.c Fri Aug 28 17:01:26 2009 -0400
+++ b/src/plugins/notify/notify-storage.c Fri Aug 28 17:01:41 2009 -0400
@@ -14,7 +14,6 @@ struct notify_transaction_context {
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 *ct
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_cont
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 -r 9f5bbc4780a1 -r 63b7223cce4b src/plugins/quota/quota-storage.c
--- a/src/plugins/quota/quota-storage.c Fri Aug 28 17:01:26 2009 -0400
+++ b/src/plugins/quota/quota-storage.c Fri Aug 28 17:01:41 2009 -0400
@@ -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
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
if (qbox->module_ctx.super.save_finish(ctx) < 0)
return -1;
- qbox->save_hack = TRUE;
return quota_check(ctx->transaction, ctx->dest_mail);
}
More information about the dovecot-cvs
mailing list