# HG changeset patch # User Timo Sirainen # Date 1452685593 -7200 # Node ID d68d75446bcc5f527fc58a8e7ff51aec19501a7b # Parent fddcd9016d78fbaeba73916da3fb834a5ca394ee 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 -r fddcd9016d78 -r d68d75446bcc src/plugins/virtual/virtual-config.c --- a/src/plugins/virtual/virtual-config.c Wed Jan 13 13:41:05 2016 +0200 +++ b/src/plugins/virtual/virtual-config.c Wed Jan 13 13:46:33 2016 +0200 @@ -116,6 +116,7 @@ { 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 @@ 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 @@ } 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 */