dovecot-2.2: doveadm mailbox delete -r: Delete all mailboxes whe...

dovecot at dovecot.org dovecot at dovecot.org
Fri Jun 12 12:17:25 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/0e947c4dbb10
changeset: 18845:0e947c4dbb10
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jun 12 15:14:52 2015 +0300
description:
doveadm mailbox delete -r: Delete all mailboxes when empty mailbox name is given.

diffstat:

 src/doveadm/doveadm-mail-mailbox.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (23 lines):

diff -r a01dc6ef392d -r 0e947c4dbb10 src/doveadm/doveadm-mail-mailbox.c
--- a/src/doveadm/doveadm-mail-mailbox.c	Fri Jun 12 13:02:08 2015 +0300
+++ b/src/doveadm/doveadm-mail-mailbox.c	Fri Jun 12 15:14:52 2015 +0300
@@ -306,7 +306,8 @@
 	const char *pattern, *child_name;
 
 	ns = mail_namespace_find(user->namespaces, name);
-	pattern = t_strdup_printf("%s%c*", name, mail_namespace_get_sep(ns));
+	pattern = name[0] == '\0' ? "*" :
+		t_strdup_printf("%s%c*", name, mail_namespace_get_sep(ns));
 	iter = mailbox_list_iter_init(ns->list, pattern,
 				      MAILBOX_LIST_ITER_RETURN_NO_FLAGS);
 	while ((info = mailbox_list_iter_next(iter)) != NULL) {
@@ -337,7 +338,8 @@
 				doveadm_mail_failed_error(_ctx, MAIL_ERROR_TEMP);
 				ret = -1;
 			}
-			array_append(&recursive_mailboxes, namep, 1);
+			if ((*namep)[0] != '\0')
+				array_append(&recursive_mailboxes, namep, 1);
 		}
 		array_sort(&recursive_mailboxes, i_strcmp_reverse_p);
 		mailboxes = &recursive_mailboxes;


More information about the dovecot-cvs mailing list