Mercurial > dovecot > core-2.2
changeset 14193:10994a5b64e1
virtual: "*" wildcard matches now also autocreated shared namespaces.
Basically this makes "shared/*" work as intended for shared namespaces.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 21 Feb 2012 02:43:52 +0200 |
parents | c854f19f10e3 |
children | 488fe9d417eb |
files | src/plugins/virtual/virtual-config.c |
diffstat | 1 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/virtual/virtual-config.c Tue Feb 21 00:13:36 2012 +0000 +++ b/src/plugins/virtual/virtual-config.c Tue Feb 21 02:43:52 2012 +0200 @@ -245,6 +245,20 @@ array_append(&ctx->mbox->backend_boxes, &bbox, 1); } +static bool virtual_ns_match(struct mail_namespace *config_ns, + struct mail_namespace *iter_ns) +{ + /* we match only one namespace for each pattern, except with shared + namespaces match also autocreated children */ + if (config_ns == iter_ns) + return TRUE; + if (config_ns->type == iter_ns->type && + (config_ns->flags & NAMESPACE_FLAG_AUTOCREATED) == 0 && + (iter_ns->flags & NAMESPACE_FLAG_AUTOCREATED) != 0) + return TRUE; + return FALSE; +} + static bool virtual_config_match(const struct mailbox_info *info, ARRAY_TYPE(virtual_backend_box) *boxes_arr, unsigned int *idx_r) @@ -255,8 +269,7 @@ boxes = array_get_modifiable(boxes_arr, &count); for (i = 0; i < count; i++) { if (boxes[i]->glob != NULL) { - /* we match only one namespace for each pattern. */ - if (boxes[i]->ns == info->ns && + if (virtual_ns_match(boxes[i]->ns, info->ns) && imap_match(boxes[i]->glob, info->name) == IMAP_MATCH_YES) { *idx_r = i;