]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
forgot to add
authorTimo Sirainen <tss@iki.fi>
Sat, 26 Jul 2003 18:24:00 +0000 (21:24 +0300)
committerTimo Sirainen <tss@iki.fi>
Sat, 26 Jul 2003 18:24:00 +0000 (21:24 +0300)
--HG--
branch : HEAD

src/imap/imap-expunge.c [new file with mode: 0644]
src/imap/imap-expunge.h [new file with mode: 0644]
src/lib-storage/index/index-expunge.h [new file with mode: 0644]

diff --git a/src/imap/imap-expunge.c b/src/imap/imap-expunge.c
new file mode 100644 (file)
index 0000000..135c9ca
--- /dev/null
@@ -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 (file)
index 0000000..8702d2d
--- /dev/null
@@ -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 (file)
index 0000000..8a78c50
--- /dev/null
@@ -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