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

tss at dovecot.org tss at dovecot.org
Wed Oct 25 00:46:16 UTC 2006


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

Modified Files:
	fts-api-private.h fts-api.c fts-api.h fts-storage.c 
Log Message:
Let FTS backend init function take a struct mailbox instead of path.



Index: fts-api-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/fts/fts-api-private.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- fts-api-private.h	17 Sep 2006 22:27:16 -0000	1.2
+++ fts-api-private.h	24 Oct 2006 23:46:14 -0000	1.3
@@ -4,7 +4,7 @@
 #include "fts-api.h"
 
 struct fts_backend_vfuncs {
-	struct fts_backend *(*init)(const char *path);
+	struct fts_backend *(*init)(struct mailbox *box);
 	void (*deinit)(struct fts_backend *backend);
 
 	struct fts_backend_build_context *

Index: fts-api.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/fts/fts-api.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- fts-api.c	17 Sep 2006 22:27:16 -0000	1.3
+++ fts-api.c	24 Oct 2006 23:46:14 -0000	1.4
@@ -33,16 +33,19 @@
 }
 
 struct fts_backend *
-fts_backend_init(const char *backend_name, const char *path)
+fts_backend_init(const char *backend_name, struct mailbox *box)
 {
 	const struct fts_backend *const *be;
 	unsigned int i, count;
 
-	be = array_get(&backends, &count);
-	for (i = 0; i < count; i++) {
-		if (strcmp(be[i]->name, backend_name) == 0)
-			return be[i]->v.init(path);
+	if (array_is_created(&backends)) {
+		be = array_get(&backends, &count);
+		for (i = 0; i < count; i++) {
+			if (strcmp(be[i]->name, backend_name) == 0)
+				return be[i]->v.init(box);
+		}
 	}
+
 	i_error("Unknown FTS backend: %s", backend_name);
 	return NULL;
 }

Index: fts-api.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/fts/fts-api.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- fts-api.h	17 Sep 2006 22:27:16 -0000	1.2
+++ fts-api.h	24 Oct 2006 23:46:14 -0000	1.3
@@ -1,10 +1,12 @@
 #ifndef __FTS_API_H
 #define __FTS_API_H
 
+struct mailbox;
+
 #include "seq-range-array.h"
 
 struct fts_backend *
-fts_backend_init(const char *backend_name, const char *path);
+fts_backend_init(const char *backend_name, struct mailbox *box);
 void fts_backend_deinit(struct fts_backend *backend);
 
 /* Initialize adding new data to the index. last_uid_r is set to the last UID

Index: fts-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/fts/fts-storage.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- fts-storage.c	17 Sep 2006 23:20:30 -0000	1.5
+++ fts-storage.c	24 Oct 2006 23:46:14 -0000	1.6
@@ -13,8 +13,6 @@
 
 #include <stdlib.h>
 
-#define FTS_INDEX_NAME "dovecot.index.fts"
-
 #define FTS_CONTEXT(obj) \
 	*((void **)array_idx_modifiable(&(obj)->module_contexts, \
 					fts_storage_module_id))
@@ -162,6 +160,7 @@
 		    (block.hdr != NULL || block.size != 0)) {
 			str_truncate(ctx->headers, 0);
 			ctx->save_part = FALSE;
+			prev_part = block.part;
 			skip_part = NULL;
 		}
 
@@ -360,7 +359,7 @@
 {
 	struct fts_mailbox *fbox;
 	struct fts_backend *backend;
-	const char *env, *path;
+	const char *env;
 
 	if (fts_next_hook_mailbox_opened != NULL)
 		fts_next_hook_mailbox_opened(box);
@@ -369,12 +368,7 @@
 	if (env == NULL)
 		return;
 
-	path = mail_storage_get_mailbox_index_dir(box->storage, box->name);
-	if (path == NULL)
-		return;
-
-	path = t_strconcat(path, "/" FTS_INDEX_NAME, NULL);
-	backend = fts_backend_init(env, path);
+	backend = fts_backend_init(env, box);
 	if (backend == NULL)
 		return;
 



More information about the dovecot-cvs mailing list