changeset 20038:b964e12c2301

lazy-expunge: Allow lazy_expunge setting to point to a mailbox in any namespace. This way we can use an existing namespace without having to create a new one just for a single lazy_expunge mailbox.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Thu, 14 Apr 2016 19:04:28 +0300
parents c27f1eac85b7
children c9eff5541312
files src/plugins/lazy-expunge/lazy-expunge-plugin.c
diffstat 1 files changed, 3 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/lazy-expunge/lazy-expunge-plugin.c	Mon Apr 18 16:40:49 2016 +0300
+++ b/src/plugins/lazy-expunge/lazy-expunge-plugin.c	Thu Apr 14 19:04:28 2016 +0300
@@ -442,16 +442,10 @@
 
 	luser->lazy_ns = mail_namespace_find_prefix(namespaces, luser->env);
 	if (luser->lazy_ns == NULL) {
-		/* see if it's set to namespace root itself. in that case we
-		   store all the expunged mails to the namespace root. */
-		luser->lazy_ns = mail_namespace_find_prefix_nosep(namespaces, luser->env);
-		if (luser->lazy_ns != NULL) {
-			luser->lazy_mailbox_vname = p_strndup(namespaces->user->pool,
-				luser->lazy_ns->prefix, luser->lazy_ns->prefix_len-1);
-		}
+		/* store the the expunged mails to the specified mailbox. */
+		luser->lazy_ns = mail_namespace_find(namespaces, luser->env);
+		luser->lazy_mailbox_vname = luser->env;
 	}
-	if (luser->lazy_ns == NULL)
-		i_fatal("lazy_expunge: Unknown namespace: '%s'", luser->env);
 	mail_namespace_ref(luser->lazy_ns);
 
 	/* we don't want to override this namespace's expunge operation. */