diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-02-18 23:46:40 +0100 |
---|---|---|
committer | Johannes Berg <johannes@sipsolutions.net> | 2008-02-18 23:46:40 +0100 |
commit | 54112a278428339accb7dcaefd806bcae77eeddd (patch) | |
tree | 2f038da6fd7d1be3272a9793bc2959b4df422122 /antispam-storage-1.0.c | |
parent | 7b5d8429116de5c1c20141190fb0a32ee0833d36 (diff) | |
download | dovecot-antispam-54112a278428339accb7dcaefd806bcae77eeddd.tar.gz dovecot-antispam-54112a278428339accb7dcaefd806bcae77eeddd.tar.xz dovecot-antispam-54112a278428339accb7dcaefd806bcae77eeddd.zip |
init/reset movetype/save_hack variables appropriately
Diffstat (limited to 'antispam-storage-1.0.c')
-rw-r--r-- | antispam-storage-1.0.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/antispam-storage-1.0.c b/antispam-storage-1.0.c index dcb64fd..578f970 100644 --- a/antispam-storage-1.0.c +++ b/antispam-storage-1.0.c @@ -48,6 +48,7 @@ struct antispam_mailbox { enum mailbox_move_type movetype; + /* used to check if copy was implemented with save */ unsigned int save_hack:1; }; @@ -105,6 +106,18 @@ antispam_copy(struct mailbox_transaction_context *t, struct mail *mail, ret = backend_handle_mail(t, ast, copy_dest_mail, move_to_class(asbox->movetype)); + /* + * Both save_hack and movetype are only valid within a copy operation, + * i.e. they are now invalid. Because, in theory, another operation + * could be done after mailbox_open(), we need to reset the movetype + * variable here. save_hack doesn't need to be reset because it is + * only ever set within the save function and tested within this copy + * function after being reset at the beginning of the copy, movetype + * however is tested within the save_finish() function and a subsequent + * save to the mailbox should not invoke the backend. + */ + asbox->movetype = MMT_UNINTERESTING; + if (copy_dest_mail != dest_mail) mail_free(©_dest_mail); return ret; @@ -242,6 +255,8 @@ static struct mailbox *antispam_mailbox_open(struct mail_storage *storage, asbox = p_new(box->pool, struct antispam_mailbox, 1); asbox->super = box->v; + asbox->save_hack = FALSE; + asbox->movetype = MMT_UNINTERESTING; /* override save_init to override want_mail, we need that */ box->v.save_init = antispam_save_init; |