dovecot-2.2: lib-storage: SEARCH_MAILBOX* value is now also comp...

dovecot at dovecot.org dovecot at dovecot.org
Tue Sep 16 12:43:54 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/ad16c74f4f36
changeset: 17817:ad16c74f4f36
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Sep 16 15:43:42 2014 +0300
description:
lib-storage: SEARCH_MAILBOX* value is now also compared to to the (virtual) mailbox name.
This fixes for example "doveadm fetch uid mailbox virtual/all"

diffstat:

 src/lib-storage/index/index-search.c |  11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diffs (32 lines):

diff -r 8c2cb7d01a78 -r ad16c74f4f36 src/lib-storage/index/index-search.c
--- a/src/lib-storage/index/index-search.c	Tue Sep 16 15:23:51 2014 +0300
+++ b/src/lib-storage/index/index-search.c	Tue Sep 16 15:43:42 2014 +0300
@@ -239,10 +239,19 @@
 static int search_arg_match_mailbox(struct index_search_context *ctx,
 				    struct mail_search_arg *arg)
 {
+	struct mailbox *box = ctx->cur_mail->box;
 	const char *str;
 
 	switch (arg->type) {
 	case SEARCH_MAILBOX:
+		/* first try to match the mailbox name itself. this is
+		   important when using "mailbox virtual/foo" parameter foin
+		   doveadm's search query, otherwise we can never fetch
+		   anything with doveadm from virtual mailboxes because the
+		   mailbox parameter is compared to the mail's backend
+		   mailbox. */
+		if (strcmp(box->vname, arg->value.str) == 0)
+			return 1;
 		if (mail_get_special(ctx->cur_mail, MAIL_FETCH_MAILBOX_NAME,
 				     &str) < 0)
 			return -1;
@@ -251,6 +260,8 @@
 			return strcasecmp(arg->value.str, "INBOX") == 0;
 		return strcmp(str, arg->value.str) == 0;
 	case SEARCH_MAILBOX_GLOB:
+		if (imap_match(arg->value.mailbox_glob, box->vname) == IMAP_MATCH_YES)
+			return 1;
 		if (mail_get_special(ctx->cur_mail, MAIL_FETCH_MAILBOX_NAME,
 				     &str) < 0)
 			return -1;


More information about the dovecot-cvs mailing list