From: Timo Sirainen Date: Sun, 30 Nov 2008 14:28:46 +0000 (+0200) Subject: fts: Hide "Searching .." notify while indexing. X-Git-Tag: 1.2.alpha5~48 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d54ab8987e482a8df250615b44f41fa040c38741;p=thirdparty%2Fdovecot%2Fcore.git fts: Hide "Searching .." notify while indexing. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/index-search.c b/src/lib-storage/index/index-search.c index 3dc342f06d..38b65630dd 100644 --- a/src/lib-storage/index/index-search.c +++ b/src/lib-storage/index/index-search.c @@ -1074,7 +1074,8 @@ static void index_storage_search_notify(struct mailbox *box, /* 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 --git a/src/lib-storage/mail-storage-private.h b/src/lib-storage/mail-storage-private.h index b82e56e12a..3b41fa8e12 100644 --- a/src/lib-storage/mail-storage-private.h +++ b/src/lib-storage/mail-storage-private.h @@ -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 --git a/src/plugins/fts/fts-storage.c b/src/plugins/fts/fts-storage.c index cde9e091e9..4ddf3b43bc 100644 --- a/src/plugins/fts/fts-storage.c +++ b/src/plugins/fts/fts-storage.c @@ -211,6 +211,7 @@ static int fts_build_init_seq(struct fts_search_context *fctx, 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(struct mail_search_context *ctx, 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 mail_search_context *ctx, 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_nonblock(struct mail_search_context *ctx, } /* finished / error */ + ctx->progress_hidden = FALSE; if (fts_build_deinit(&fctx->build_ctx) < 0) ret = -1; if (ret > 0) {