dovecot: Each message has two UIDs stored (body and header), so ...

dovecot at dovecot.org dovecot at dovecot.org
Sun Feb 10 22:07:22 EET 2008


details:   http://hg.dovecot.org/dovecot/rev/3deaf85bb47c
changeset: 7222:3deaf85bb47c
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Feb 10 22:07:18 2008 +0200
description:
Each message has two UIDs stored (body and header), so build the expunge
list using those UIDs instead of the real message UIDs.

diffstat:

1 file changed, 6 insertions(+), 3 deletions(-)
src/plugins/fts-squat/fts-backend-squat.c |    9 ++++++---

diffs (26 lines):

diff -r e042b6385c7b -r 3deaf85bb47c src/plugins/fts-squat/fts-backend-squat.c
--- a/src/plugins/fts-squat/fts-backend-squat.c	Sun Feb 10 21:54:57 2008 +0200
+++ b/src/plugins/fts-squat/fts-backend-squat.c	Sun Feb 10 22:07:18 2008 +0200
@@ -116,8 +116,11 @@ static int get_all_msg_uids(struct mailb
 
 	mail = mail_alloc(t, 0, NULL);
 	search_ctx = mailbox_search_init(t, NULL, &search_arg, NULL);
-	while ((ret = mailbox_search_next(search_ctx, mail)) > 0)
-		seq_range_array_add(uids, 0, mail->uid);
+	while ((ret = mailbox_search_next(search_ctx, mail)) > 0) {
+		/* *2 because even/odd is for body/header */
+		seq_range_array_add_range(uids, mail->uid * 2,
+					  mail->uid * 2 + 1);
+	}
 	if (mailbox_search_deinit(&search_ctx) < 0)
 		ret = -1;
 	mail_free(&mail);
@@ -137,7 +140,7 @@ fts_backend_squat_build_deinit(struct ft
 	if (get_all_msg_uids(ctx->ctx.backend->box, &uids) < 0)
 		ret = squat_trie_build_deinit(&ctx->build_ctx, NULL);
 	else {
-		seq_range_array_invert(&uids, 1, (uint32_t)-2);
+		seq_range_array_invert(&uids, 2, (uint32_t)-2);
 		ret = squat_trie_build_deinit(&ctx->build_ctx, &uids);
 	}
 	array_free(&uids);


More information about the dovecot-cvs mailing list