expire-plugin.c revision e34d170f8f0e084bd94bfbc1a7085ece67e508df
45312f52ff3a3d4c137447be4c7556500c2f8bf2Timo Sirainen/* Copyright (c) 2006-2012 Dovecot authors, see the included COPYING file */
63946971b08cfb1eec698c28569e1c4aa237852dTimo Sirainen union mailbox_transaction_module_context module_ctx;
828edf966ee46f65ec5d907f310cab270e7e1088Timo Sirainenconst char *expire_plugin_version = DOVECOT_VERSION;
a04cd96888653891272a512f7735121193af7b35Timo Sirainenstatic MODULE_CONTEXT_DEFINE_INIT(expire_storage_module,
55a7410569737197afb302b07b488973324b0cc5Timo Sirainenstatic MODULE_CONTEXT_DEFINE_INIT(expire_mail_module, &mail_module_register);
828edf966ee46f65ec5d907f310cab270e7e1088Timo Sirainenstatic MODULE_CONTEXT_DEFINE_INIT(expire_mail_user_module,
a04cd96888653891272a512f7735121193af7b35Timo Sirainenexpire_mailbox_transaction_begin(struct mailbox *box,
55a7410569737197afb302b07b488973324b0cc5Timo Sirainen struct expire_mailbox *xpr_box = EXPIRE_CONTEXT(box);
55a7410569737197afb302b07b488973324b0cc5Timo Sirainen t = xpr_box->module_ctx.super.transaction_begin(box, flags);
e60a349c641bb2f4723e4a395a25f55531682d2bTimo Sirainen xt = i_new(struct expire_transaction_context, 1);
a04cd96888653891272a512f7735121193af7b35Timo Sirainen MODULE_CONTEXT_SET(t, expire_storage_module, xt);
a04cd96888653891272a512f7735121193af7b35Timo Sirainenstatic void first_nonexpunged_timestamp(struct mailbox_transaction_context *t,
828edf966ee46f65ec5d907f310cab270e7e1088Timo Sirainen /* find the first non-expunged mail. we're here because the first
828edf966ee46f65ec5d907f310cab270e7e1088Timo Sirainen mail was expunged, so don't bother checking it. */
828edf966ee46f65ec5d907f310cab270e7e1088Timo Sirainen for (seq = 2; seq <= hdr->messages_count; seq++) {
55a7410569737197afb302b07b488973324b0cc5Timo Sirainen /* everything expunged */
c4b376dd6e0c423006d7ac83a39253bcaf8e7c47Timo Sirainenstatic void first_save_timestamp(struct mailbox *box, time_t *stamp_r)
55a7410569737197afb302b07b488973324b0cc5Timo Sirainen /* find the first non-expunged mail. we're here because the first
55a7410569737197afb302b07b488973324b0cc5Timo Sirainen mail was expunged, so don't bother checking it. */
55a7410569737197afb302b07b488973324b0cc5Timo Sirainenexpire_mailbox_transaction_commit(struct mailbox_transaction_context *t,
e60a349c641bb2f4723e4a395a25f55531682d2bTimo Sirainen struct mail_transaction_commit_changes *changes_r)
fd4632d0060b2e9eef513b544ccff1e26d1fc222Timo Sirainen struct mail_user *user = t->box->storage->user;
55a7410569737197afb302b07b488973324b0cc5Timo Sirainen struct expire_mail_user *euser = EXPIRE_USER_CONTEXT(user);
4525c4a8f8d1a6365e4469c0c8f46575400a9a67Timo Sirainen struct expire_mailbox *xpr_box = EXPIRE_CONTEXT(t->box);
55a7410569737197afb302b07b488973324b0cc5Timo Sirainen struct expire_transaction_context *xt = EXPIRE_CONTEXT(t);
d43bed2d458520fd01c28229ce2b178a4593a4a7Timo Sirainen /* first mail expunged. dict needs updating. */
c4b376dd6e0c423006d7ac83a39253bcaf8e7c47Timo Sirainen /* everything was expunged, but also within this
97cfe59cd16ce624e58e8d9b6003d1e29d75b3d2Timo Sirainen transaction a new message was saved */
55a7410569737197afb302b07b488973324b0cc5Timo Sirainen i_debug("expire: Expunging first message in %s, "
t = NULL;
if (ret <= 0) {
if (ret < 0) {
if (update_dict) {
} T_END;
const char *str;
i_unreached();
const char *dict_uri;
void expire_plugin_deinit(void)