dovecot-2.0: virtual: If we can't open a mailbox that was added ...
dovecot at dovecot.org
dovecot at dovecot.org
Mon May 18 01:45:36 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/eb67ef194562
changeset: 9316:eb67ef194562
user: Timo Sirainen <tss at iki.fi>
date: Sun May 17 18:45:23 2009 -0400
description:
virtual: If we can't open a mailbox that was added using a wildcard, just skip it.
diffstat:
3 files changed, 15 insertions(+), 3 deletions(-)
src/plugins/virtual/virtual-config.c | 1 +
src/plugins/virtual/virtual-storage.c | 16 +++++++++++++---
src/plugins/virtual/virtual-storage.h | 1 +
diffs (64 lines):
diff -r 7344f1a53f0f -r eb67ef194562 src/plugins/virtual/virtual-config.c
--- a/src/plugins/virtual/virtual-config.c Sun May 17 18:35:30 2009 -0400
+++ b/src/plugins/virtual/virtual-config.c Sun May 17 18:45:23 2009 -0400
@@ -213,6 +213,7 @@ static void virtual_config_copy_expanded
*bbox = *wbox;
bbox->name = p_strdup(ctx->pool, name);
bbox->glob = NULL;
+ bbox->wildcard = TRUE;
mail_search_args_ref(bbox->search_args);
array_append(&ctx->mbox->backend_boxes, &bbox, 1);
}
diff -r 7344f1a53f0f -r eb67ef194562 src/plugins/virtual/virtual-storage.c
--- a/src/plugins/virtual/virtual-storage.c Sun May 17 18:35:30 2009 -0400
+++ b/src/plugins/virtual/virtual-storage.c Sun May 17 18:45:23 2009 -0400
@@ -210,7 +210,7 @@ static int virtual_mailboxes_open(struct
open_flags |= MAILBOX_OPEN_KEEP_RECENT;
bboxes = array_get(&mbox->backend_boxes, &count);
- for (i = 0; i < count; i++) {
+ for (i = 0; i < count; ) {
mailbox = bboxes[i]->name;
ns = mail_namespace_find(user->namespaces, &mailbox);
storage = ns->storage;
@@ -218,10 +218,19 @@ static int virtual_mailboxes_open(struct
NULL, open_flags);
if (bboxes[i]->box == NULL) {
+ str = mail_storage_get_last_error(storage, &error);
+ if (bboxes[i]->wildcard &&
+ (error == MAIL_ERROR_PERM ||
+ error == MAIL_ERROR_NOTFOUND)) {
+ /* this mailbox wasn't explicitly specified.
+ just skip it. */
+ mail_search_args_unref(&bboxes[i]->search_args);
+ array_delete(&mbox->backend_boxes, i, 1);
+ bboxes = array_get(&mbox->backend_boxes, &count);
+ continue;
+ }
if (storage != mbox->ibox.box.storage) {
/* copy the error */
- str = mail_storage_get_last_error(storage,
- &error);
mail_storage_set_error(mbox->ibox.box.storage,
error, str);
}
@@ -231,6 +240,7 @@ static int virtual_mailboxes_open(struct
i_array_init(&bboxes[i]->sync_pending_removes, 64);
mail_search_args_init(bboxes[i]->search_args, bboxes[i]->box,
FALSE, NULL);
+ i++;
}
if (i == count)
return 0;
diff -r 7344f1a53f0f -r eb67ef194562 src/plugins/virtual/virtual-storage.h
--- a/src/plugins/virtual/virtual-storage.h Sun May 17 18:35:30 2009 -0400
+++ b/src/plugins/virtual/virtual-storage.h Sun May 17 18:45:23 2009 -0400
@@ -90,6 +90,7 @@ struct virtual_backend_box {
struct mail_namespace *ns;
unsigned int sync_seen:1;
+ unsigned int wildcard:1;
};
ARRAY_DEFINE_TYPE(virtual_backend_box, struct virtual_backend_box *);
More information about the dovecot-cvs
mailing list