[dovecot-cvs] dovecot/src/imap Makefile.am, 1.36, 1.37 cmd-list.c, 1.58, 1.59 common.h, 1.22, 1.23 imap-sync.c, 1.20, 1.21 imap-thread.c, 1.28, 1.29 main.c, 1.82, 1.83 namespace.c, 1.16, 1.17

tss at dovecot.org tss at dovecot.org
Sat Nov 25 22:17:42 UTC 2006


Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv28938/imap

Modified Files:
	Makefile.am cmd-list.c common.h imap-sync.c imap-thread.c 
	main.c namespace.c 
Log Message:
Mailbox list indexing and related changes. Currently works only with
maildir and mmap_disable=no. This allows doing STATUS to synced mailboxes
without opening their index files at all.



Index: Makefile.am
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/Makefile.am,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- Makefile.am	16 Nov 2006 00:16:32 -0000	1.36
+++ Makefile.am	25 Nov 2006 22:17:40 -0000	1.37
@@ -21,8 +21,8 @@
 
 libs = \
 	../lib-storage/register/libstorage-register.a \
-	$(STORAGE_LIBS) \
 	../lib-storage/list/libstorage_list.a \
+	$(STORAGE_LIBS) \
 	../lib-storage/libstorage.a \
 	../lib-imap/libimap.a \
 	../lib-mail/libmail.a \

Index: cmd-list.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-list.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- cmd-list.c	16 Nov 2006 00:16:32 -0000	1.58
+++ cmd-list.c	25 Nov 2006 22:17:40 -0000	1.59
@@ -33,13 +33,6 @@
 {
 	const char *str;
 
-	if (flags & MAILBOX_PLACEHOLDER) {
-		i_assert((flags & ~MAILBOX_CHILDREN) == MAILBOX_PLACEHOLDER);
-
-		if ((list_flags & _MAILBOX_LIST_ITER_LISTEXT) == 0)
-			flags = MAILBOX_NOSELECT;
-		flags |= MAILBOX_CHILDREN;
-	}
 	if ((flags & MAILBOX_NONEXISTENT) != 0 &&
 	    (list_flags & _MAILBOX_LIST_ITER_LISTEXT) == 0) {
 		flags |= MAILBOX_NOSELECT;
@@ -52,7 +45,6 @@
 	str = t_strconcat(
 		(flags & MAILBOX_NOSELECT) ? " \\Noselect" : "",
 		(flags & MAILBOX_NONEXISTENT) ? " \\NonExistent" : "",
-		(flags & MAILBOX_PLACEHOLDER) ? " \\PlaceHolder" : "",
 		(flags & MAILBOX_CHILDREN) ? " \\HasChildren" : "",
 		(flags & MAILBOX_NOCHILDREN) ? " \\HasNoChildren" : "",
 		(flags & MAILBOX_NOINFERIORS) ? " \\NoInferiors" : "",
@@ -318,7 +310,7 @@
                         enum mailbox_info_flags flags;
 			string_t *str = t_str_new(128);
 
-			flags = MAILBOX_PLACEHOLDER;
+			flags = MAILBOX_NONEXISTENT | MAILBOX_CHILDREN;
 			str_printfa(str, "* LIST (%s) \"%s\" ",
 				    mailbox_flags2str(flags, ctx->list_flags),
 				    ns->sep_str);
@@ -386,7 +378,8 @@
 	cur_mask = namespace_fix_sep(ns, cur_mask);
 
 	list = mail_storage_get_list(ns->storage);
-	ctx->list_iter = mailbox_list_iter_init(list, cur_ref, cur_mask,
+	cur_mask = mailbox_list_join_refmask(list, cur_ref, cur_mask);
+	ctx->list_iter = mailbox_list_iter_init(list, cur_mask,
 						ctx->list_flags);
 }
 

Index: common.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/common.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- common.h	22 Jul 2005 14:20:44 -0000	1.22
+++ common.h	25 Nov 2006 22:17:40 -0000	1.23
@@ -37,7 +37,6 @@
 
 extern string_t *capability_string;
 
-extern void (*hook_mail_storage_created)(struct mail_storage *storage);
 extern void (*hook_client_created)(struct client **client);
 
 #endif

Index: imap-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/imap-sync.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- imap-sync.c	20 Feb 2006 17:34:02 -0000	1.20
+++ imap-sync.c	25 Nov 2006 22:17:40 -0000	1.21
@@ -63,7 +63,9 @@
 
 	mail_free(&ctx->mail);
 
-	if (mailbox_sync_deinit(&ctx->sync_ctx, &status) < 0 || ctx->failed) {
+	if (mailbox_sync_deinit(&ctx->sync_ctx,
+				STATUS_MESSAGES | STATUS_RECENT, &status) < 0 ||
+	    ctx->failed) {
 		mailbox_transaction_rollback(&ctx->t);
 		i_free(ctx);
 		return -1;
@@ -190,12 +192,11 @@
 {
 	struct mailbox_sync_context *ctx;
         struct mailbox_sync_rec sync_rec;
-	struct mailbox_status status;
 
 	ctx = mailbox_sync_init(box, flags);
 	while (mailbox_sync_next(ctx, &sync_rec) > 0)
 		;
-	return mailbox_sync_deinit(&ctx, &status);
+	return mailbox_sync_deinit(&ctx, 0, NULL);
 }
 
 static bool cmd_sync_continue(struct client_command_context *cmd)

Index: imap-thread.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/imap-thread.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- imap-thread.c	17 Sep 2006 18:34:15 -0000	1.28
+++ imap-thread.c	25 Nov 2006 22:17:40 -0000	1.29
@@ -2017,17 +2017,42 @@
 					    tbox, TRUE);
 }
 
+static struct mailbox_sync_context *
+imap_thread_sync_init(struct mailbox *box, enum mailbox_sync_flags flags)
+{
+	struct imap_thread_mailbox *tbox = IMAP_THREAD_CONTEXT(box);
+	struct mailbox_sync_context *ctx;
+
+	ctx = tbox->super.sync_init(box, flags);
+	if (box->opened) {
+		imap_thread_hash_init(box, FALSE);
+		/* we don't want to get back here */
+		box->v.sync_init = tbox->super.sync_init;
+	}
+	return ctx;
+}
+
 static void imap_thread_mailbox_opened(struct mailbox *box)
 {
 	struct imap_thread_mailbox *tbox;
 
+	if (next_hook_mailbox_opened != NULL)
+		next_hook_mailbox_opened(box);
+
 	tbox = i_new(struct imap_thread_mailbox, 1);
 	tbox->super = box->v;
 
 	array_idx_set(&box->module_contexts,
 		      imap_thread_storage_module_id, &tbox);
 
-	imap_thread_hash_init(box, FALSE);
+	if (box->opened)
+		imap_thread_hash_init(box, FALSE);
+	else {
+		/* delayed opening used. we want to try to open the hash
+		   anyway, because if syncing expunges anything and we didn't
+		   notice it, we would have to rebuild the hash */
+		box->v.sync_init = imap_thread_sync_init;
+	}
 }
 
 void imap_thread_init(void)

Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/main.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -d -r1.82 -r1.83
--- main.c	16 Nov 2006 00:16:32 -0000	1.82
+++ main.c	25 Nov 2006 22:17:40 -0000	1.83
@@ -48,7 +48,6 @@
 static char log_prefix[128]; /* syslog() needs this to be permanent */
 static pool_t namespace_pool;
 
-void (*hook_mail_storage_created)(struct mail_storage *storage) = NULL;
 void (*hook_client_created)(struct client **client) = NULL;
 
 string_t *capability_string;

Index: namespace.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/namespace.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- namespace.c	16 Nov 2006 01:41:01 -0000	1.16
+++ namespace.c	25 Nov 2006 22:17:40 -0000	1.17
@@ -20,9 +20,6 @@
 	} else {
 		ns->sep_str[0] = ns->sep;
 	}
-
-	if (hook_mail_storage_created != NULL)
-		hook_mail_storage_created(ns->storage);
 }
 
 static struct namespace *



More information about the dovecot-cvs mailing list