]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
fts: Hide "Searching .." notify while indexing.
authorTimo Sirainen <tss@iki.fi>
Sun, 30 Nov 2008 14:28:46 +0000 (16:28 +0200)
committerTimo Sirainen <tss@iki.fi>
Sun, 30 Nov 2008 14:28:46 +0000 (16:28 +0200)
--HG--
branch : HEAD

src/lib-storage/index/index-search.c
src/lib-storage/mail-storage-private.h
src/plugins/fts/fts-storage.c

index 3dc342f06d8307025cf8d5fa4b8a760cb32a7f73..38b65630dd6a1fb7fa1a309a6cb6c8b1295245e5 100644 (file)
@@ -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 -
index b82e56e12ac1336a183a1f6e24decf601e97f1bb..3b41fa8e125b7901b60d526ff49c45dbe84517ae 100644 (file)
@@ -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 {
index cde9e091e9b2a25bc48ed439163e472db6aa8e96..4ddf3b43bc1d3218c6374db93a5726b10c6073e2 100644 (file)
@@ -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) {