From: Timo Sirainen Date: Wed, 13 Jan 2016 11:46:33 +0000 (+0200) Subject: virtual plugin: Cleaned up behavior of '!' prefix with '+' and '-' X-Git-Tag: 2.2.22.rc1~365 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=28d6a9ec6b055ad6141f0961fe971543f781d4a6;p=thirdparty%2Fdovecot%2Fcore.git virtual plugin: Cleaned up behavior of '!' prefix with '+' and '-' It makes a bit more sense now. Mainly the difference is that "!foo*" means to save mails to a mailbox called "foo*", instead of including mailboxes matching "!foo*" pattern to the virtual mailbox. It's unlikely anyone was relying on this behavior. --- diff --git a/src/plugins/virtual/virtual-config.c b/src/plugins/virtual/virtual-config.c index d47c43c5a8..9e88695efe 100644 --- a/src/plugins/virtual/virtual-config.c +++ b/src/plugins/virtual/virtual-config.c @@ -116,6 +116,7 @@ virtual_config_parse_line(struct virtual_parse_context *ctx, const char *line, { struct mail_user *user = ctx->mbox->storage->storage.user; struct virtual_backend_box *bbox; + bool no_wildcards = FALSE; if (*line == ' ' || *line == '\t') { /* continues the previous search rule */ @@ -155,13 +156,7 @@ virtual_config_parse_line(struct virtual_parse_context *ctx, const char *line, bbox->name++; bbox->negative_match = TRUE; break; - } - - if (strchr(bbox->name, '*') != NULL || - strchr(bbox->name, '%') != NULL) { - bbox->glob = imap_match_init(ctx->pool, bbox->name, TRUE, ctx->sep); - ctx->have_wildcards = TRUE; - } else if (bbox->name[0] == '!') { + case '!': /* save messages here */ if (ctx->mbox->save_bbox != NULL) { *error_r = "Multiple save mailboxes defined"; @@ -169,6 +164,15 @@ virtual_config_parse_line(struct virtual_parse_context *ctx, const char *line, } bbox->name++; ctx->mbox->save_bbox = bbox; + no_wildcards = TRUE; + break; + } + + if (!no_wildcards && + (strchr(bbox->name, '*') != NULL || + strchr(bbox->name, '%') != NULL)) { + bbox->glob = imap_match_init(ctx->pool, bbox->name, TRUE, ctx->sep); + ctx->have_wildcards = TRUE; } /* now that the prefix characters have been processed, find the namespace */