diff src/lib-storage/list/mailbox-list-index-notify.c @ 22454:725057ef25e4

lib-storage: Optimize INBOX notifications with mailbox_list_index_include_inbox=yes There's no need for special INBOX checks in that case, because INBOX is tracked in the mailbox list index the same as any other mailbox.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Mon, 04 Sep 2017 16:55:30 +0300
parents c5eae96dcd71
children 056a93bfc669
line wrap: on
line diff
--- a/src/lib-storage/list/mailbox-list-index-notify.c	Mon Sep 04 19:37:12 2017 +0300
+++ b/src/lib-storage/list/mailbox-list-index-notify.c	Mon Sep 04 16:55:30 2017 +0300
@@ -101,9 +101,14 @@
 		inotify->subscriptions = mailbox_tree_dup(list->subscriptions);
 	}
 	inotify->list_log_path = i_strdup(ilist->index->log->filepath);
-	if ((list->ns->flags & NAMESPACE_FLAG_INBOX_ANY) != 0 &&
-	    mailbox_list_get_path(list, "INBOX", MAILBOX_LIST_PATH_TYPE_INDEX,
-				  &index_dir) > 0) {
+	if (list->mail_set->mailbox_list_index_include_inbox) {
+		/* INBOX can be handled also using mailbox list index */
+	} else if ((list->ns->flags & NAMESPACE_FLAG_INBOX_ANY) == 0) {
+		/* no INBOX in this namespace */
+	} else if (mailbox_list_get_path(list, "INBOX", MAILBOX_LIST_PATH_TYPE_INDEX,
+					 &index_dir) <= 0) {
+		/* no indexes for INBOX? can't handle it */
+	} else {
 		/* FIXME: annoyingly hardcoded filename. */
 		inotify->inbox_log_path = i_strdup_printf(
 			"%s/"MAIL_INDEX_PREFIX".log", index_dir);