From: Timo Sirainen Date: Sat, 26 Jul 2003 18:24:00 +0000 (+0300) Subject: forgot to add X-Git-Tag: 1.1.alpha1~4461 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=25fdbae285d682b7e54ac103ccfb95e032b6ff1f;p=thirdparty%2Fdovecot%2Fcore.git forgot to add --HG-- branch : HEAD --- diff --git a/src/imap/imap-expunge.c b/src/imap/imap-expunge.c new file mode 100644 index 0000000000..135c9caaa8 --- /dev/null +++ b/src/imap/imap-expunge.c @@ -0,0 +1,29 @@ +/* Copyright (C) 2003 Timo Sirainen */ + +#include "common.h" +#include "mail-storage.h" +#include "imap-expunge.h" + +int imap_expunge(struct mailbox *box, int notify) +{ + struct mail_expunge_context *ctx; + struct mail *mail; + int failed = FALSE; + + ctx = box->expunge_init(box, 0, FALSE); + if (ctx == NULL) + return FALSE; + + while ((mail = box->expunge_fetch_next(ctx)) != NULL) { + if (!mail->expunge(mail, ctx, NULL, notify)) { + failed = TRUE; + break; + } + } + + if (!box->expunge_deinit(ctx)) + return FALSE; + + return !failed; +} + diff --git a/src/imap/imap-expunge.h b/src/imap/imap-expunge.h new file mode 100644 index 0000000000..8702d2d6f4 --- /dev/null +++ b/src/imap/imap-expunge.h @@ -0,0 +1,6 @@ +#ifndef __IMAP_EXPUNGE_H +#define __IMAP_EXPUNGE_H + +int imap_expunge(struct mailbox *box, int notify); + +#endif diff --git a/src/lib-storage/index/index-expunge.h b/src/lib-storage/index/index-expunge.h new file mode 100644 index 0000000000..8a78c50651 --- /dev/null +++ b/src/lib-storage/index/index-expunge.h @@ -0,0 +1,28 @@ +#ifndef __INDEX_EXPUNGE_H +#define __INDEX_EXPUNGE_H + +#include "mail-storage.h" +#include "index-mail.h" + +struct mail_expunge_context { + struct index_mailbox *ibox; + struct index_mail mail; + int expunge_all, fetch_next, failed; + + unsigned int seq; + struct mail_index_record *rec; + + unsigned int first_seq, last_seq; + struct mail_index_record *first_rec, *last_rec; +}; + +struct mail_expunge_context * +index_storage_expunge_init(struct mailbox *box, + enum mail_fetch_field wanted_fields, + int expunge_all); +int index_storage_expunge_deinit(struct mail_expunge_context *ctx); +struct mail *index_storage_expunge_fetch_next(struct mail_expunge_context *ctx); +int index_storage_expunge(struct mail *mail, struct mail_expunge_context *ctx, + unsigned int *seq_r, int notify); + +#endif