expire-plugin.c revision 5d49cbcf87354f0ddf3b71bc5f0cefdc02b14f68
/* Copyright (c) 2006-2009 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "array.h"
#include "str.h"
#include "master-service.h"
#include "dict.h"
#include "mail-namespace.h"
#include "index-mail.h"
#include "index-storage.h"
#include "expire-env.h"
#include "expire-plugin.h"
#include <stdlib.h>
#define EXPIRE_CONTEXT(obj) \
#define EXPIRE_MAIL_CONTEXT(obj) \
#define EXPIRE_USER_CONTEXT(obj) \
struct expire_mail_user {
struct expire_env *env;
};
struct expire_mailbox {
union mailbox_module_context module_ctx;
unsigned int altmove:1;
};
struct expire_transaction_context {
unsigned int saves:1;
unsigned int first_expunged:1;
};
const char *expire_plugin_version = PACKAGE_VERSION;
static struct mailbox_transaction_context *
{
struct mailbox_transaction_context *t;
struct expire_transaction_context *xt;
return t;
}
{
struct index_transaction_context *t =
(struct index_transaction_context *)_t;
const struct mail_index_header *hdr;
/* find the first non-expunged mail. we're here because the first
mail was expunged, so don't bother checking it. */
break;
}
}
/* everything expunged */
*stamp_r = 0;
}
}
static int
struct mail_transaction_commit_changes *changes_r)
{
struct expire_mail_user *euser =
bool update_dict = FALSE;
int ret;
/* only moving mails - don't update the move stamps */
} else if (xt->first_expunged) {
/* first mail expunged. dict needs updating. */
update_dict = TRUE;
}
return -1;
}
/* transaction is freed now */
t = NULL;
if (xt->first_expunged) {
} else {
/* saved new mails. dict needs to be updated only if
this is the first mail in the database */
update_dict = ret == 0 ||
/* may not be exactly the first message's save time
but a few second difference doesn't matter */
}
if (update_dict) {
struct dict_transaction_context *dctx;
if (new_stamp == 0) {
/* everything expunged */
} else {
}
}
} T_END;
return 0;
}
static void
{
}
{
struct expire_transaction_context *xt =
/* first mail expunged, database needs to be updated */
}
}
static struct mail *
expire_mail_alloc(struct mailbox_transaction_context *t,
struct mailbox_header_lookup_ctx *wanted_headers)
{
union mail_module_context *xpr_mail;
struct mail_private *mail;
return _mail;
}
{
struct expire_transaction_context *xt =
}
static int
{
struct expire_transaction_context *xt =
}
static void
{
struct expire_mailbox *xpr_box;
}
struct expire_mail_user *euser)
{
unsigned int secs;
bool altmove;
if (secs == 0) {
i_info("expire: No expiring in mailbox: %s",
} else {
i_info("expire: Mails expire in %u secs in mailbox: %s",
}
}
if (secs != 0)
}
{
struct expire_mail_user *euser =
if (next_hook_mailbox_allocated != NULL)
}
{
}
{
struct expire_mail_user *euser;
/* expire-tool handles all of this internally */
if (user->mail_debug) {
i_info("expire: No expire or expire_altmove settings - "
"plugin disabled");
}
i_error("expire plugin: expire_dict setting missing");
} else {
/* we're using only shared dictionary, the username
doesn't matter. */
else
}
}
void expire_plugin_init(void)
{
}
void expire_plugin_deinit(void)
{
}