24
24
bool only_selectable;
28
28
search_args_get_mailbox_patterns(const struct mail_search_arg *args,
29
29
ARRAY_TYPE(const_string) *patterns,
30
30
bool *have_guid, bool *have_wildcards)
71
71
struct mail_user *user,
72
72
struct mail_search_args *search_args,
73
73
enum mailbox_list_iter_flags iter_flags,
74
enum namespace_type ns_mask)
74
enum mail_namespace_type ns_mask)
76
76
static const char *all_pattern = "*";
77
77
struct doveadm_mailbox_list_iter *iter;
82
82
iter->search_args = search_args;
84
84
i_array_init(&iter->patterns, 16);
85
search_args_get_mailbox_patterns(search_args->args, &iter->patterns,
86
&have_guid, &have_wildcards);
85
(void)search_args_get_mailbox_patterns(search_args->args,
87
&have_guid, &have_wildcards);
88
89
if (array_count(&iter->patterns) == 0) {
89
90
iter_flags |= MAILBOX_LIST_ITER_SKIP_ALIASES;
91
ns_mask |= NAMESPACE_SHARED | NAMESPACE_PUBLIC;
92
ns_mask |= MAIL_NAMESPACE_TYPE_SHARED |
93
MAIL_NAMESPACE_TYPE_PUBLIC;
92
95
array_append(&iter->patterns, &all_pattern, 1);
93
96
} else if (have_wildcards) {
94
97
iter_flags |= MAILBOX_LIST_ITER_STAR_WITHIN_NS;
95
ns_mask |= NAMESPACE_SHARED | NAMESPACE_PUBLIC;
98
ns_mask |= MAIL_NAMESPACE_TYPE_SHARED |
99
MAIL_NAMESPACE_TYPE_PUBLIC;
97
101
/* just return the listed mailboxes without actually
98
102
iterating through. this also allows accessing mailboxes
99
103
without lookup ACL right */
102
(void)array_append_space(&iter->patterns);
106
array_append_zero(&iter->patterns);
104
108
iter->only_selectable = TRUE;
105
109
iter->iter_flags = iter_flags;
115
119
struct mail_search_args *search_args,
116
120
enum mailbox_list_iter_flags iter_flags)
118
enum namespace_type ns_mask = NAMESPACE_PRIVATE;
122
enum mail_namespace_type ns_mask = MAIL_NAMESPACE_TYPE_PRIVATE;
120
124
return doveadm_mailbox_list_iter_init_nsmask(ctx, user, search_args,
121
125
iter_flags, ns_mask);
127
131
struct mail_search_args *search_args,
128
132
enum mailbox_list_iter_flags iter_flags)
130
enum namespace_type ns_mask =
131
NAMESPACE_PRIVATE | NAMESPACE_SHARED | NAMESPACE_PUBLIC;
134
enum mail_namespace_type ns_mask = MAIL_NAMESPACE_TYPE_MASK_ALL;
132
135
struct doveadm_mailbox_list_iter *iter;
134
137
iter = doveadm_mailbox_list_iter_init_nsmask(ctx, user, search_args,
167
170
if (iter->pattern_idx == count)
170
iter->info.name = patterns[iter->pattern_idx++];
173
iter->info.vname = patterns[iter->pattern_idx++];
171
174
iter->info.ns = mail_namespace_find(iter->user->namespaces,
173
if (iter->info.ns != NULL)
175
/* FIXME: maybe fail?.. or just wait for v2.2 to get rid of
176
this error condition */
179
179
while ((info = mailbox_list_iter_next(iter->iter)) != NULL) {