changeset 1645:c846d6735042 HEAD

forgot to add
author Timo Sirainen <tss@iki.fi>
date Sat, 26 Jul 2003 21:24:00 +0300
parents 9ce620b10b28
children a7c742b940e5
files src/imap/imap-expunge.c src/imap/imap-expunge.h src/lib-storage/index/index-expunge.h
diffstat 3 files changed, 63 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/imap/imap-expunge.c	Sat Jul 26 21:24:00 2003 +0300
@@ -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;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/imap/imap-expunge.h	Sat Jul 26 21:24:00 2003 +0300
@@ -0,0 +1,6 @@
+#ifndef __IMAP_EXPUNGE_H
+#define __IMAP_EXPUNGE_H
+
+int imap_expunge(struct mailbox *box, int notify);
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lib-storage/index/index-expunge.h	Sat Jul 26 21:24:00 2003 +0300
@@ -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