diff src/imap/cmd-thread.c @ 8146:70b53e9b232e HEAD

Rewrote thread indexing code. It's a lot simpler and takes less disk space. We no longer try to keep a hash table and the entire thread tree stored on disk. Instead we keep a simple Message-ID string (actually just "uid, ref#" pointer) -> unique index number mapping on disk, read it to memory and use it to build the thread tree. After the initial build the thread tree is still updated incrementally.
author Timo Sirainen <tss@iki.fi>
date Mon, 01 Sep 2008 15:17:00 +0300
parents d987e018483b
children b9faf4db2a9f
line wrap: on
line diff
--- a/src/imap/cmd-thread.c	Mon Sep 01 15:11:54 2008 +0300
+++ b/src/imap/cmd-thread.c	Mon Sep 01 15:17:00 2008 +0300
@@ -80,27 +80,18 @@
 {
 	struct mail_thread_context *ctx;
 	string_t *str;
-	bool reset = FALSE;
 	int ret;
 
 	i_assert(thread_type == MAIL_THREAD_REFERENCES ||
 		 thread_type == MAIL_THREAD_REFERENCES2);
 
 	str = str_new(default_pool, 1024);
-	for (;;) {
-		ret = mail_thread_init(cmd->client->mailbox, reset,
-				       search_args, &ctx);
-		if (ret == 0) {
-			ret = imap_thread_write_reply(ctx, str, thread_type,
-						      !cmd->uid);
-			mail_thread_deinit(&ctx);
-		}
-
-		if (ret == 0 || reset)
-			break;
-		/* try again with in-memory hash */
-		reset = TRUE;
-		str_truncate(str, 0);
+	ret = mail_thread_init(cmd->client->mailbox,
+			       search_args, &ctx);
+	if (ret == 0) {
+		ret = imap_thread_write_reply(ctx, str, thread_type,
+					      !cmd->uid);
+		mail_thread_deinit(&ctx);
 	}
 
 	if (ret == 0) {