dovecot-1.2: fts: Hide "Searching .." notify while indexing.

dovecot at dovecot.org dovecot at dovecot.org
Sun Nov 30 16:29:21 EET 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/689a63a99363
changeset: 8508:689a63a99363
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Nov 30 16:28:46 2008 +0200
description:
fts: Hide "Searching .." notify while indexing.

diffstat:

3 files changed, 9 insertions(+), 1 deletion(-)
src/lib-storage/index/index-search.c   |    3 ++-
src/lib-storage/mail-storage-private.h |    1 +
src/plugins/fts/fts-storage.c          |    6 ++++++

diffs (61 lines):

diff -r f323bf2465bd -r 689a63a99363 src/lib-storage/index/index-search.c
--- a/src/lib-storage/index/index-search.c	Sun Nov 30 15:57:41 2008 +0200
+++ b/src/lib-storage/index/index-search.c	Sun Nov 30 16:28:46 2008 +0200
@@ -1074,7 +1074,8 @@ static void index_storage_search_notify(
 		/* set the search time in here, in case a plugin
 		   already spent some time indexing the mailbox */
 		ctx->search_start_time = ioloop_timeval;
-	} else if (box->storage->callbacks->notify_ok != NULL) {
+	} else if (box->storage->callbacks->notify_ok != NULL &&
+		   !ctx->mail_ctx.progress_hidden) {
 		percentage = ctx->mail_ctx.progress_cur * 100.0 /
 			ctx->mail_ctx.progress_max;
 		msecs = (ioloop_timeval.tv_sec -
diff -r f323bf2465bd -r 689a63a99363 src/lib-storage/mail-storage-private.h
--- a/src/lib-storage/mail-storage-private.h	Sun Nov 30 15:57:41 2008 +0200
+++ b/src/lib-storage/mail-storage-private.h	Sun Nov 30 16:28:46 2008 +0200
@@ -329,6 +329,7 @@ struct mail_search_context {
 	ARRAY_DEFINE(module_contexts, union mail_search_module_context *);
 
 	unsigned int seen_lost_data:1;
+	unsigned int progress_hidden:1;
 };
 
 struct mail_save_context {
diff -r f323bf2465bd -r 689a63a99363 src/plugins/fts/fts-storage.c
--- a/src/plugins/fts/fts-storage.c	Sun Nov 30 15:57:41 2008 +0200
+++ b/src/plugins/fts/fts-storage.c	Sun Nov 30 16:28:46 2008 +0200
@@ -211,6 +211,7 @@ static int fts_build_init_seq(struct fts
 	ctx->headers = str_new(default_pool, 512);
 	ctx->mail = mail_alloc(t, 0, NULL);
 	ctx->search_ctx = mailbox_search_init(t, search_args, NULL);
+	ctx->search_ctx->progress_hidden = TRUE;
 	ctx->search_args = search_args;
 
 	fctx->build_ctx = ctx;
@@ -529,6 +530,7 @@ static void fts_search_init_lookup(struc
 		ctx->progress_max = array_count(&fctx->definite_seqs) +
 			array_count(&fctx->maybe_seqs);
 	}
+	ctx->progress_cur = 0;
 }
 
 static bool fts_try_build_init(struct mail_search_context *ctx,
@@ -553,6 +555,9 @@ static bool fts_try_build_init(struct ma
 	if (fctx->build_ctx == NULL) {
 		/* the index was up to date */
 		fts_search_init_lookup(ctx, fctx);
+	} else {
+		/* hide "searching" notifications */
+		ctx->progress_hidden = TRUE;
 	}
 	return TRUE;
 }
@@ -611,6 +616,7 @@ static int fts_mailbox_search_next_nonbl
 		}
 
 		/* finished / error */
+		ctx->progress_hidden = FALSE;
 		if (fts_build_deinit(&fctx->build_ctx) < 0)
 			ret = -1;
 		if (ret > 0) {


More information about the dovecot-cvs mailing list