[dovecot-cvs] dovecot/src/plugins/fts fts-api-private.h, 1.4, 1.5 fts-api.c, 1.5, 1.6 fts-api.h, 1.4, 1.5 fts-storage.c, 1.7, 1.8

tss at dovecot.org tss at dovecot.org
Wed Oct 25 21:24:58 UTC 2006


Update of /var/lib/cvs/dovecot/src/plugins/fts
In directory talvi:/tmp/cvs-serv6142

Modified Files:
	fts-api-private.h fts-api.c fts-api.h fts-storage.c 
Log Message:
ADd support for expunges



Index: fts-api-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/fts/fts-api-private.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- fts-api-private.h	25 Oct 2006 20:02:42 -0000	1.4
+++ fts-api-private.h	25 Oct 2006 20:24:55 -0000	1.5
@@ -16,6 +16,8 @@
 			  const unsigned char *data, size_t size);
 	int (*build_deinit)(struct fts_backend_build_context *ctx);
 
+	void (*expunge)(struct fts_backend *backend, struct mail *mail);
+
 	int (*lookup)(struct fts_backend *backend, const char *key,
 		      ARRAY_TYPE(seq_range) *result);
 	int (*filter)(struct fts_backend *backend, const char *key,

Index: fts-api.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/fts/fts-api.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- fts-api.c	25 Oct 2006 20:02:42 -0000	1.5
+++ fts-api.c	25 Oct 2006 20:24:55 -0000	1.6
@@ -77,6 +77,11 @@
 	return ctx->backend->v.build_deinit(ctx);
 }
 
+void fts_backend_expunge(struct fts_backend *backend, struct mail *mail)
+{
+	backend->v.expunge(backend, mail);
+}
+
 int fts_backend_lookup(struct fts_backend *backend, const char *key,
 		       ARRAY_TYPE(seq_range) *result)
 {

Index: fts-api.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/fts/fts-api.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- fts-api.h	25 Oct 2006 20:02:43 -0000	1.4
+++ fts-api.h	25 Oct 2006 20:24:55 -0000	1.5
@@ -1,6 +1,7 @@
 #ifndef __FTS_API_H
 #define __FTS_API_H
 
+struct mail;
 struct mailbox;
 
 #include "seq-range-array.h"
@@ -24,6 +25,9 @@
 /* Finish adding new data to the index. */
 int fts_backend_build_deinit(struct fts_backend_build_context *ctx);
 
+/* Expunge given mail from the backend. */
+void fts_backend_expunge(struct fts_backend *backend, struct mail *mail);
+
 /* Lookup key from the index and return the found UIDs in result. */
 int fts_backend_lookup(struct fts_backend *backend, const char *key,
 		       ARRAY_TYPE(seq_range) *result);

Index: fts-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/fts/fts-storage.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- fts-storage.c	25 Oct 2006 20:02:43 -0000	1.7
+++ fts-storage.c	25 Oct 2006 20:24:55 -0000	1.8
@@ -27,6 +27,10 @@
 	unsigned int result_pos;
 };
 
+struct fts_mail {
+	struct mail_vfuncs super;
+};
+
 static unsigned int fts_storage_module_id = 0;
 static bool fts_storage_module_id_set = FALSE;
 
@@ -371,6 +375,40 @@
 	return fbox->super.search_deinit(ctx);
 }
 
+static int fts_mail_expunge(struct mail *_mail)
+{
+	struct mail_private *mail = (struct mail_private *)_mail;
+	struct fts_mail *fmail = FTS_CONTEXT(mail);
+	struct fts_mailbox *fbox = FTS_CONTEXT(_mail->box);
+
+	if (fmail->super.expunge(_mail) < 0)
+		return -1;
+
+	fts_backend_expunge(fbox->backend, _mail);
+	return 0;
+}
+
+static struct mail *
+fts_mail_alloc(struct mailbox_transaction_context *t,
+	       enum mail_fetch_field wanted_fields,
+	       struct mailbox_header_lookup_ctx *wanted_headers)
+{
+	struct fts_mailbox *fbox = FTS_CONTEXT(t->box);
+	struct fts_mail *fmail;
+	struct mail *_mail;
+	struct mail_private *mail;
+
+	_mail = fbox->super.mail_alloc(t, wanted_fields, wanted_headers);
+	mail = (struct mail_private *)_mail;
+
+	fmail = p_new(mail->pool, struct fts_mail, 1);
+	fmail->super = mail->v;
+
+	mail->v.expunge = fts_mail_expunge;
+	array_idx_set(&mail->module_contexts, fts_storage_module_id, &fmail);
+	return _mail;
+}
+
 void fts_mailbox_opened(struct mailbox *box)
 {
 	struct fts_mailbox *fbox;
@@ -395,6 +433,7 @@
 	box->v.search_init = fts_mailbox_search_init;
 	box->v.search_next_update_seq = fts_mailbox_search_next_update_seq;
 	box->v.search_deinit = fts_mailbox_search_deinit;
+	box->v.mail_alloc = fts_mail_alloc;
 
 	if (!fts_storage_module_id_set) {
 		fts_storage_module_id = mail_storage_module_id++;



More information about the dovecot-cvs mailing list