trash-plugin.c revision 2731d9f2ca860ed3f343ea2eae42e3e76c42a96d
212b5e1a0422841260addc7e9878a6e99fc2f254Knut Anders Hatlen/* Copyright (C) 2005 Timo Sirainen */
01bfcfd168ac9fffe2d80a88093acccb88706ef6Knut Anders Hatlen int priority; /* lower number = higher priority */
212b5e1a0422841260addc7e9878a6e99fc2f254Knut Anders Hatlen /* temporarily set while cleaning: */
212b5e1a0422841260addc7e9878a6e99fc2f254Knut Anders Hatlen struct mailbox_transaction_context *trans;
212b5e1a0422841260addc7e9878a6e99fc2f254Knut Anders Hatlenconst char *trash_plugin_version = PACKAGE_VERSION;
212b5e1a0422841260addc7e9878a6e99fc2f254Knut Anders Hatlenstatic int (*trash_next_quota_test_alloc)(struct quota_transaction_context *,
212b5e1a0422841260addc7e9878a6e99fc2f254Knut Anders Hatlen/* trash_boxes ordered by priority, highest first */
212b5e1a0422841260addc7e9878a6e99fc2f254Knut Anders Hatlenstatic ARRAY_DEFINE(trash_boxes, struct trash_mailbox);
212b5e1a0422841260addc7e9878a6e99fc2f254Knut Anders Hatlenstatic int sync_mailbox(struct mailbox *box)
212b5e1a0422841260addc7e9878a6e99fc2f254Knut Anders Hatlen ctx = mailbox_sync_init(box, MAILBOX_SYNC_FLAG_FULL_READ);
212b5e1a0422841260addc7e9878a6e99fc2f254Knut Anders Hatlen while (mailbox_sync_next(ctx, &sync_rec) > 0)
212b5e1a0422841260addc7e9878a6e99fc2f254Knut Anders Hatlen return mailbox_sync_deinit(&ctx, 0, NULL);
212b5e1a0422841260addc7e9878a6e99fc2f254Knut Anders Hatlenstatic int trash_clean_mailbox_open(struct trash_mailbox *trash)
edafc572181ae79d8a2d4587f82448656b573c02Trond Norbye trash->box = mailbox_open(trash->storage, trash->name, NULL,
212b5e1a0422841260addc7e9878a6e99fc2f254Knut Anders Hatlen trash->trans = mailbox_transaction_begin(trash->box, 0);
212b5e1a0422841260addc7e9878a6e99fc2f254Knut Anders Hatlen trash->search_ctx = mailbox_search_init(trash->trans, NULL,
212b5e1a0422841260addc7e9878a6e99fc2f254Knut Anders Hatlen trash->mail = mail_alloc(trash->trans, MAIL_FETCH_PHYSICAL_SIZE |
212b5e1a0422841260addc7e9878a6e99fc2f254Knut Anders Hatlen return mailbox_search_next(trash->search_ctx, trash->mail);
212b5e1a0422841260addc7e9878a6e99fc2f254Knut Anders Hatlenstatic int trash_clean_mailbox_get_next(struct trash_mailbox *trash,
if (ret <= 0) {
*received_time_r = 0;
return ret;
int ret = 0;
for (i = 0; i < count; ) {
for (j = i; j < count; j++) {
&received);
if (ret < 0)
goto __err;
if (ret > 0) {
oldest_idx = j;
for (i = 0; i < count; i++) {
return FALSE;
return TRUE;
int ret, i;
return ret;
if (i == MAX_RETRY_COUNT) {
if (ret <= 0)
unsigned int count;
int fd;
void trash_plugin_init(void)
const char *env;
sizeof(trash_boxes) +
void trash_plugin_deinit(void)