expire-plugin.c revision 783278c012551bc2f25f065a8d3ec1a3cfc0d296
/* Copyright (c) 2006-2008 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "array.h"
#include "str.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) \
struct expire {
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
{
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;
}
first_saved_uid_r, last_saved_uid_r) < 0) {
return -1;
}
/* transaction is freed now */
t = NULL;
/* 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
{
}
static void
{
struct expire_mailbox *xpr_box;
}
static struct mailbox *
{
union mail_storage_module_context *xpr_storage =
unsigned int secs;
bool altmove;
&altmove);
if (secs != 0)
}
return box;
}
{
}
void expire_plugin_init(void)
{
i_fatal("expire plugin: expire_dict setting missing");
/* we're using only shared dictionary, the username
doesn't matter. */
i_fatal("expire plugin: dict_init() failed");
i_info("expire: No expire or expire_altmove settings - "
"plugin disabled");
}
}
void expire_plugin_deinit(void)
{
}
}