doveadm-mailbox-list-iter.c revision e8c6287f4489b7dc3f4af8eab3f97abe44cf1706
/* Copyright (c) 2010-2012 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "str.h"
#include "mail-search.h"
#include "mail-namespace.h"
#include "mailbox-list.h"
#include "doveadm-mail.h"
#include "doveadm-mailbox-list-iter.h"
struct doveadm_mailbox_list_iter {
struct doveadm_mail_cmd_context *ctx;
struct mail_search_args *search_args;
struct mailbox_list_iterate_context *iter;
struct mailbox_info info;
unsigned int pattern_idx;
bool only_selectable;
};
static int
bool *have_guid, bool *have_wildcards)
{
const struct mail_search_arg *subargs;
case SEARCH_OR:
/* we don't currently try to optimize OR. */
break;
case SEARCH_SUB:
case SEARCH_INTHREAD:
return 0;
}
break;
case SEARCH_MAILBOX_GLOB:
*have_wildcards = TRUE;
/* fall through */
case SEARCH_MAILBOX:
return 0;
}
break;
case SEARCH_MAILBOX_GUID:
break;
default:
break;
}
}
return 1;
}
static struct doveadm_mailbox_list_iter *
struct mail_search_args *search_args,
enum namespace_type ns_mask)
{
static const char *all_pattern = "*";
struct doveadm_mailbox_list_iter *iter;
&have_guid, &have_wildcards);
if (have_guid)
} else if (have_wildcards) {
} else {
/* just return the listed mailboxes without actually
iterating through. this also allows accessing mailboxes
without lookup ACL right */
return iter;
}
return iter;
}
struct doveadm_mailbox_list_iter *
struct mail_search_args *search_args,
{
}
struct doveadm_mailbox_list_iter *
struct mail_search_args *search_args,
{
enum namespace_type ns_mask =
struct doveadm_mailbox_list_iter *iter;
return iter;
}
{
int ret;
ret = 0;
i_error("Listing mailboxes failed");
}
return ret;
}
const struct mailbox_info *
{
const struct mailbox_info *info;
const char *const *patterns;
unsigned int count;
return NULL;
/* FIXME: maybe fail?.. or just wait for v2.2 to get rid of
this error condition */
}
MAILBOX_NONEXISTENT)) != 0) {
if (iter->only_selectable)
continue;
}
break;
}
return info;
}