]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
virtual: Support +mailbox entries that clear \Recent flag from messages.
authorTimo Sirainen <tss@iki.fi>
Wed, 16 Mar 2011 17:17:57 +0000 (19:17 +0200)
committerTimo Sirainen <tss@iki.fi>
Wed, 16 Mar 2011 17:17:57 +0000 (19:17 +0200)
src/plugins/virtual/virtual-config.c
src/plugins/virtual/virtual-storage.c
src/plugins/virtual/virtual-storage.h

index c048084d91488a2de8d0d4424078ebdff78f10e3..d3fe5e8278aa48eae0be3bd230e215c5589324fb 100644 (file)
@@ -134,7 +134,7 @@ virtual_config_parse_line(struct virtual_parse_context *ctx, const char *line,
        if (strcasecmp(line, "INBOX") == 0)
                line = "INBOX";
        bbox->name = p_strdup(ctx->pool, line);
-       if (*line == '-' || *line == '!') line++;
+       if (*line == '-' || *line == '+' || *line == '!') line++;
        bbox->ns = strcasecmp(line, "INBOX") == 0 ?
                mail_namespace_find_inbox(user->namespaces) :
                mail_namespace_find(user->namespaces, &line);
@@ -143,6 +143,11 @@ virtual_config_parse_line(struct virtual_parse_context *ctx, const char *line,
                                           bbox->name);
                return -1;
        }
+       if (bbox->name[0] == '+') {
+               bbox->name++;
+               bbox->clear_recent = TRUE;
+       }
+
        if (strchr(bbox->name, '*') != NULL ||
            strchr(bbox->name, '%') != NULL) {
                name = bbox->name[0] == '-' ? bbox->name + 1 : bbox->name;
index b0ef4b9b281b099d6874d2c48be654dd305fb83f..6b85820a00d911b52027e971a376120212c0cd99 100644 (file)
@@ -173,7 +173,8 @@ static int virtual_backend_box_open(struct virtual_mailbox *mbox,
 
        i_assert(bbox->box == NULL);
 
-       flags |= MAILBOX_FLAG_KEEP_RECENT;
+       if (!bbox->clear_recent)
+               flags |= MAILBOX_FLAG_KEEP_RECENT;
 
        mailbox = bbox->name;
        ns = mail_namespace_find(user->namespaces, &mailbox);
index 7814fcca9628ad9bd06e9950a974b7b624badfc1..c3a019d571426597b549e0a905073e254eac8cbc 100644 (file)
@@ -95,6 +95,7 @@ struct virtual_backend_box {
 
        unsigned int sync_seen:1;
        unsigned int wildcard:1;
+       unsigned int clear_recent:1;
        unsigned int uids_nonsorted:1;
 };
 ARRAY_DEFINE_TYPE(virtual_backend_box, struct virtual_backend_box *);