Mercurial > dovecot > original-hg > dovecot-1.2
changeset 5839:978722ad6184 HEAD
s/mask/pattern/ for mailbox listing.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 29 Jun 2007 19:41:22 +0300 |
parents | 4906791b8256 |
children | f4dac54df44e |
files | src/imap/cmd-list.c src/lib-storage/list/index-mailbox-list.c src/lib-storage/list/mailbox-list-fs-iter.c src/lib-storage/list/mailbox-list-fs.c src/lib-storage/list/mailbox-list-fs.h src/lib-storage/list/mailbox-list-maildir-iter.c src/lib-storage/list/mailbox-list-maildir.c src/lib-storage/list/mailbox-list-maildir.h src/lib-storage/mailbox-list-private.h src/lib-storage/mailbox-list.c src/lib-storage/mailbox-list.h |
diffstat | 11 files changed, 149 insertions(+), 141 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/cmd-list.c Fri Jun 29 19:26:27 2007 +0300 +++ b/src/imap/cmd-list.c Fri Jun 29 19:41:22 2007 +0300 @@ -12,7 +12,7 @@ struct cmd_list_context { struct client_command_context *cmd; const char *ref; - const char *mask; + const char *pattern; enum mailbox_list_flags list_flags; struct mail_namespace *ns; @@ -267,7 +267,7 @@ return FALSE; } } else if (!ctx->cur_ns_match_inbox) { - /* The mask doesn't match INBOX (eg. prefix.%). + /* The pattern doesn't match INBOX (eg. prefix.%). We still want to list prefix.INBOX if it has children. Otherwise we don't want to list this INBOX at all. */ @@ -313,7 +313,7 @@ flags = info->flags; if (*ctx->ns->prefix != '\0') { - /* With masks containing '*' we do the checks here + /* With patterns containing '*' we do the checks here so prefix is included in matching */ if (ctx->glob != NULL && imap_match(ctx->glob, name) != IMAP_MATCH_YES) @@ -361,54 +361,56 @@ return ret < 0 ? -1 : 1; } -static bool list_mask_has_wildcards(const char *mask) +static bool list_pattern_has_wildcards(const char *pattern) { - for (; *mask != '\0'; mask++) { - if (*mask == '%' || *mask == '*') + for (; *pattern != '\0'; pattern++) { + if (*pattern == '%' || *pattern == '*') return TRUE; } return FALSE; } static void -skip_namespace_prefix(const char **prefix, const char **mask, +skip_namespace_prefix(const char **prefix, const char **pattern, bool inbox_check, char sep) { - size_t mask_len, prefix_len; + size_t pattern_len, prefix_len; bool match; prefix_len = strlen(*prefix); - mask_len = strlen(*mask); + pattern_len = strlen(*pattern); - if (mask_len < prefix_len) { - /* eg. namespace prefix = "INBOX.", mask = "INBOX" */ + if (pattern_len < prefix_len) { + /* eg. namespace prefix = "INBOX.", pattern = "INBOX" */ return; } - match = strncmp(*prefix, *mask, prefix_len) == 0; + match = strncmp(*prefix, *pattern, prefix_len) == 0; if (!match && inbox_check) { /* try INBOX check. */ match = prefix_len >= 5 && - strncasecmp(*prefix, *mask, 5) == 0 && - strncmp(*prefix + 5, *mask + 5, prefix_len - 5) == 0 && + strncasecmp(*prefix, *pattern, 5) == 0 && + strncmp(*prefix + 5, *pattern + 5, + prefix_len - 5) == 0 && strncasecmp(*prefix, "INBOX", 5) == 0 && ((*prefix)[5] == sep || (*prefix)[5] == '\0'); } if (match) { *prefix += prefix_len; - *mask += prefix_len; + *pattern += prefix_len; } } static bool -skip_namespace_prefix_refmask(struct cmd_list_context *ctx, - const char **cur_ns_prefix_p, - const char **cur_ref_p, const char **cur_mask_p) +skip_namespace_prefix_refpattern(struct cmd_list_context *ctx, + const char **cur_ns_prefix_p, + const char **cur_ref_p, + const char **cur_pattern_p) { const char *cur_ns_prefix = *cur_ns_prefix_p; const char *cur_ref = *cur_ref_p; - const char *cur_mask = *cur_mask_p; + const char *cur_pattern = *cur_pattern_p; if (*ctx->ns->prefix == '\0') return TRUE; @@ -433,25 +435,25 @@ } if (*cur_ns_prefix != '\0') { - /* skip namespace prefix using mask */ + /* skip namespace prefix using pattern */ const char *old_ns_prefix = cur_ns_prefix; - const char *old_mask = cur_mask; + const char *old_pattern = cur_pattern; i_assert(*cur_ref == '\0'); - skip_namespace_prefix(&cur_ns_prefix, &cur_mask, + skip_namespace_prefix(&cur_ns_prefix, &cur_pattern, cur_ref == ctx->ref, ctx->ns->sep); - if (*cur_mask == '\0' && *cur_ns_prefix == '\0') { + if (*cur_pattern == '\0' && *cur_ns_prefix == '\0') { /* trying to list the namespace prefix itself. */ cur_ns_prefix = old_ns_prefix; - cur_mask = old_mask; + cur_pattern = old_pattern; } } *cur_ns_prefix_p = cur_ns_prefix; *cur_ref_p = cur_ref; - *cur_mask_p = cur_mask; + *cur_pattern_p = cur_pattern; return TRUE; } @@ -464,19 +466,19 @@ (ctx->ns->flags & NAMESPACE_FLAG_INBOX) == 0) return IMAP_MATCH_NO; - /* if the original reference and mask combined produces something + /* if the original reference and pattern combined produces something that matches INBOX, the INBOX casing is on. */ inbox_glob = imap_match_init(ctx->cmd->pool, - t_strconcat(ctx->ref, ctx->mask, NULL), + t_strconcat(ctx->ref, ctx->pattern, NULL), TRUE, ctx->ns->sep); return imap_match(inbox_glob, "INBOX"); } static void -skip_mask_wildcard_prefix(const char *cur_ns_prefix, char sep, - const char **cur_mask_p) +skip_pattern_wildcard_prefix(const char *cur_ns_prefix, char sep, + const char **cur_pattern_p) { - const char *cur_mask = *cur_mask_p; + const char *cur_pattern = *cur_pattern_p; unsigned int count; for (count = 1; *cur_ns_prefix != '\0'; cur_ns_prefix++) { @@ -486,38 +488,38 @@ for (; count > 0; count--) { /* skip over one hierarchy */ - while (*cur_mask != '\0' && *cur_mask != '*' && - *cur_mask != sep) - cur_mask++; + while (*cur_pattern != '\0' && *cur_pattern != '*' && + *cur_pattern != sep) + cur_pattern++; - if (*cur_mask == '*') { + if (*cur_pattern == '*') { /* we'll just request "*" and filter it ourself. otherwise this gets too complex. */ - cur_mask = "*"; + cur_pattern = "*"; break; } - if (*cur_mask == '\0') { - /* mask ended too early. we won't be listing + if (*cur_pattern == '\0') { + /* pattern ended too early. we won't be listing any mailboxes. */ break; } - cur_mask++; + cur_pattern++; } - *cur_mask_p = cur_mask; + *cur_pattern_p = cur_pattern; } static void list_namespace_init(struct cmd_list_context *ctx) { struct mail_namespace *ns = ctx->ns; - const char *cur_ns_prefix, *cur_ref, *cur_mask; + const char *cur_ns_prefix, *cur_ref, *cur_pattern; enum imap_match_result match; enum imap_match_result inbox_match; size_t len; cur_ns_prefix = ns->prefix; cur_ref = ctx->ref; - cur_mask = ctx->mask; + cur_pattern = ctx->pattern; if ((ctx->ns->flags & NAMESPACE_FLAG_HIDDEN) != 0 && (ctx->list_flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) != 0) { @@ -530,22 +532,22 @@ if ((ns->flags & NAMESPACE_FLAG_INBOX) != 0) ctx->seen_inbox_namespace = TRUE; - if (!skip_namespace_prefix_refmask(ctx, &cur_ns_prefix, - &cur_ref, &cur_mask)) + if (!skip_namespace_prefix_refpattern(ctx, &cur_ns_prefix, + &cur_ref, &cur_pattern)) return; inbox_match = list_use_inboxcase(ctx); ctx->cur_ns_match_inbox = inbox_match == IMAP_MATCH_YES; - ctx->glob = imap_match_init(ctx->cmd->pool, ctx->mask, + ctx->glob = imap_match_init(ctx->cmd->pool, ctx->pattern, (inbox_match == IMAP_MATCH_YES || inbox_match == IMAP_MATCH_PARENT) && - cur_mask == ctx->mask, ns->sep); + cur_pattern == ctx->pattern, ns->sep); if (*cur_ns_prefix != '\0') { /* namespace prefix still wasn't completely skipped over. - for example cur_ns_prefix=INBOX/, mask=%/% or mask=IN%. - Check that mask matches namespace prefix. */ + for example cur_ns_prefix=INBOX/, pattern=%/% or pattern=IN%. + Check that pattern matches namespace prefix. */ i_assert(*cur_ref == '\0'); /* drop the trailing separator in namespace prefix. @@ -553,7 +555,7 @@ (LIST "" foo/ needs to return "foo/" entry) */ len = strlen(cur_ns_prefix); if (cur_ns_prefix[len-1] == ns->sep && - strcmp(cur_mask, cur_ns_prefix) != 0) { + strcmp(cur_pattern, cur_ns_prefix) != 0) { ctx->cur_ns_skip_trailing_sep = TRUE; cur_ns_prefix = t_strndup(cur_ns_prefix, len-1); } @@ -561,7 +563,7 @@ /* hidden and non-listable namespaces should still be seen without wildcards. */ match = ((ns->flags & NAMESPACE_FLAG_LIST) == 0 && - list_mask_has_wildcards(cur_mask)) ? + list_pattern_has_wildcards(cur_pattern)) ? IMAP_MATCH_NO : imap_match(ctx->glob, cur_ns_prefix); if (match < 0) return; @@ -576,24 +578,26 @@ if (*cur_ns_prefix != '\0') { /* We didn't skip over the whole namespace prefix. For example - cur_ns_prefix=INBOX/ and mask=%/% or IN*. + cur_ns_prefix=INBOX/ and pattern=%/% or IN*. - We have already verified that the mask matches the namespace - prefix, so we'll just have to skip over as many hierarchies - from mask as there exists in namespace prefix. */ + We have already verified that the pattern matches the + namespace prefix, so we'll just have to skip over as many + hierarchies from pattern as there exists in namespace + prefix. */ i_assert(*cur_ref == '\0'); - skip_mask_wildcard_prefix(cur_ns_prefix, ns->sep, &cur_mask); + skip_pattern_wildcard_prefix(cur_ns_prefix, ns->sep, + &cur_pattern); - if (*cur_mask == '\0' && ctx->cur_ns_match_inbox) { + if (*cur_pattern == '\0' && ctx->cur_ns_match_inbox) { /* ns_prefix="INBOX/" and we wanted to list "%". This is an optimization to avoid doing an empty listing followed by another INBOX listing later. */ - cur_mask = "INBOX"; + cur_pattern = "INBOX"; } } - if (*cur_mask != '*' || strcmp(ctx->mask, "*") == 0) { - /* a) we don't have '*' in mask + if (*cur_pattern != '*' || strcmp(ctx->pattern, "*") == 0) { + /* a) we don't have '*' in pattern b) we want to display everything we don't need to do separate filtering ourself */ @@ -601,10 +605,11 @@ } cur_ref = mail_namespace_fix_sep(ns, cur_ref); - cur_mask = mail_namespace_fix_sep(ns, cur_mask); + cur_pattern = mail_namespace_fix_sep(ns, cur_pattern); - cur_mask = mailbox_list_join_refmask(ns->list, cur_ref, cur_mask); - ctx->list_iter = mailbox_list_iter_init(ns->list, cur_mask, + cur_pattern = mailbox_list_join_refpattern(ns->list, + cur_ref, cur_pattern); + ctx->list_iter = mailbox_list_iter_init(ns->list, cur_pattern, ctx->list_flags); } @@ -710,7 +715,7 @@ const struct imap_arg *args; enum mailbox_list_flags list_flags = 0; struct cmd_list_context *ctx; - const char *ref, *mask; + const char *ref, *pattern; bool used_listext = FALSE; /* [(<selection options>)] <reference> <pattern>|(<pattern list>) @@ -730,13 +735,13 @@ ref = imap_arg_string(&args[0]); if (ref == NULL) { /* broken */ - mask = NULL; + pattern = NULL; } else if (args[1].type == IMAP_ARG_LIST) { /* FIXME: pattern list */ - mask = NULL; + pattern = NULL; args += 2; } else { - mask = imap_arg_string(&args[1]); + pattern = imap_arg_string(&args[1]); args += 2; } @@ -765,16 +770,16 @@ return TRUE; } - if (mask != NULL && *mask == '\0' && !lsub) { - /* only with mask string, not with list */ + if (pattern != NULL && *pattern == '\0' && !lsub) { + /* only with pattern string, not with list */ cmd_list_ref_root(client, ref); client_send_tagline(cmd, "OK List completed."); } else { - /* FIXME: handle mask lists */ + /* FIXME: handle pattern lists */ ctx = p_new(cmd->pool, struct cmd_list_context, 1); ctx->cmd = cmd; ctx->ref = ref; - ctx->mask = mask; + ctx->pattern = pattern; ctx->list_flags = list_flags; ctx->used_listext = used_listext; ctx->lsub = lsub;
--- a/src/lib-storage/list/index-mailbox-list.c Fri Jun 29 19:26:27 2007 +0300 +++ b/src/lib-storage/list/index-mailbox-list.c Fri Jun 29 19:41:22 2007 +0300 @@ -79,26 +79,26 @@ return hdr->sync_stamp == ctx->sync_stamp; } -static void mask_parse(struct mailbox_list *list, const char *mask, - const char **prefix_r, int *recurse_level_r) +static void pattern_parse(struct mailbox_list *list, const char *pattern, + const char **prefix_r, int *recurse_level_r) { char sep = list->hierarchy_sep; const char *prefix_start, *prefix_end; bool seen_wildcards = FALSE; int recurse_level = 0; - prefix_start = prefix_end = mask; - for (; *mask != '\0'; mask++) { - if (*mask == '%') + prefix_start = prefix_end = pattern; + for (; *pattern != '\0'; pattern++) { + if (*pattern == '%') seen_wildcards = TRUE; - else if (*mask == '*') { + else if (*pattern == '*') { recurse_level = -1; break; } - if (*mask == sep) { + if (*pattern == sep) { if (!seen_wildcards) - prefix_end = mask; + prefix_end = pattern; recurse_level++; } } @@ -109,7 +109,7 @@ } static struct mailbox_list_iterate_context * -index_mailbox_list_iter_init(struct mailbox_list *list, const char *mask, +index_mailbox_list_iter_init(struct mailbox_list *list, const char *pattern, enum mailbox_list_iter_flags flags) { struct index_mailbox_list *ilist = INDEX_LIST_CONTEXT(list); @@ -121,7 +121,7 @@ ctx = i_new(struct index_mailbox_list_iterate_context, 1); ctx->ctx.list = list; ctx->ctx.flags = flags; - ctx->glob = imap_match_init(default_pool, mask, TRUE, + ctx->glob = imap_match_init(default_pool, pattern, TRUE, list->hierarchy_sep); ctx->mail_view = mail_index_view_open(ilist->mail_index); @@ -130,10 +130,10 @@ if ((flags & MAILBOX_LIST_ITER_RAW_LIST) != 0) { /* Ignore indexes completely */ ctx->backend_ctx = ilist->module_ctx.super. - iter_init(list, mask, flags); + iter_init(list, pattern, flags); } else if (index_mailbox_list_is_synced(ctx) > 0) { /* synced, list from index */ - mask_parse(list, mask, &prefix, &recurse_level); + pattern_parse(list, pattern, &prefix, &recurse_level); ctx->info_pool = pool_alloconly_create("mailbox name pool", 128); @@ -147,7 +147,7 @@ /* FIXME: this works nicely with maildir++, but not others */ sync_flags = MAILBOX_LIST_SYNC_FLAG_RECURSIVE; - if (strchr(mask, '*') != NULL) + if (strchr(pattern, '*') != NULL) ctx->recurse_level = -1; else { ctx->mailbox_tree = @@ -159,14 +159,14 @@ if (mailbox_list_index_sync_init(ilist->list_index, "", sync_flags, &ctx->sync_ctx) == 0) { - mask = "*"; + pattern = "*"; prefix = ""; ctx->trans = mailbox_list_index_sync_get_transaction( ctx->sync_ctx); } ctx->backend_ctx = ilist->module_ctx.super. - iter_init(list, mask, flags); + iter_init(list, pattern, flags); } return &ctx->ctx; }
--- a/src/lib-storage/list/mailbox-list-fs-iter.c Fri Jun 29 19:26:27 2007 +0300 +++ b/src/lib-storage/list/mailbox-list-fs-iter.c Fri Jun 29 19:41:22 2007 +0300 @@ -41,17 +41,17 @@ static const struct mailbox_info * fs_list_next(struct fs_list_iterate_context *ctx); -static const char *mask_get_dir(const char *mask) +static const char *pattern_get_dir(const char *pattern) { const char *p, *last_dir; last_dir = NULL; - for (p = mask; *p != '\0' && *p != '%' && *p != '*'; p++) { + for (p = pattern; *p != '\0' && *p != '%' && *p != '*'; p++) { if (*p == '/') last_dir = p; } - return last_dir == NULL ? NULL : t_strdup_until(mask, last_dir); + return last_dir == NULL ? NULL : t_strdup_until(pattern, last_dir); } static int list_opendir(struct mailbox_list *list, @@ -83,7 +83,7 @@ } struct mailbox_list_iterate_context * -fs_list_iter_init(struct mailbox_list *_list, const char *mask, +fs_list_iter_init(struct mailbox_list *_list, const char *pattern, enum mailbox_list_iter_flags flags) { struct fs_list_iterate_context *ctx; @@ -95,10 +95,10 @@ ctx->ctx.flags = flags; ctx->info_pool = pool_alloconly_create("fs list", 1024); ctx->next = fs_list_next; - ctx->glob = imap_match_init(default_pool, mask, TRUE, '/'); + ctx->glob = imap_match_init(default_pool, pattern, TRUE, '/'); /* check that we're not trying to do any "../../" lists */ - if (!mailbox_list_is_valid_mask(_list, mask)) + if (!mailbox_list_is_valid_pattern(_list, pattern)) return &ctx->ctx; if ((flags & (MAILBOX_LIST_ITER_SELECT_SUBSCRIBED | @@ -123,7 +123,7 @@ /* if we're matching only subdirectories, don't bother scanning the parent directories */ - virtual_path = mask_get_dir(mask); + virtual_path = pattern_get_dir(pattern); path = mailbox_list_get_path(_list, virtual_path, MAILBOX_LIST_PATH_TYPE_DIR); @@ -255,7 +255,7 @@ (fname[1] == '.' && fname[2] == '\0'))) return 0; - /* check the mask */ + /* check the pattern */ if (ctx->dir->virtual_path == NULL) list_path = fname; else {
--- a/src/lib-storage/list/mailbox-list-fs.c Fri Jun 29 19:26:27 2007 +0300 +++ b/src/lib-storage/list/mailbox-list-fs.c Fri Jun 29 19:41:22 2007 +0300 @@ -96,12 +96,12 @@ } static bool -fs_is_valid_mask(struct mailbox_list *list, const char *mask) +fs_is_valid_pattern(struct mailbox_list *list, const char *pattern) { if ((list->flags & MAILBOX_LIST_FLAG_FULL_FS_ACCESS) != 0) return TRUE; - return fs_list_is_valid_common_nonfs(list, mask); + return fs_list_is_valid_common_nonfs(list, pattern); } static bool @@ -159,7 +159,7 @@ i_unreached(); } - i_assert(mailbox_list_is_valid_mask(_list, name)); + i_assert(mailbox_list_is_valid_pattern(_list, name)); if ((list->list.flags & MAILBOX_LIST_FLAG_FULL_FS_ACCESS) != 0 && (*name == '/' || *name == '~')) { @@ -241,16 +241,16 @@ } static const char * -fs_list_join_refmask(struct mailbox_list *_list __attr_unused__, - const char *ref, const char *mask) +fs_list_join_refpattern(struct mailbox_list *_list __attr_unused__, + const char *ref, const char *pattern) { - if (*mask == '/' || *mask == '~') { - /* mask overrides reference */ + if (*pattern == '/' || *pattern == '~') { + /* pattern overrides reference */ } else if (*ref != '\0') { - /* merge reference and mask */ - mask = t_strconcat(ref, mask, NULL); + /* merge reference and pattern */ + pattern = t_strconcat(ref, pattern, NULL); } - return mask; + return pattern; } static int fs_list_set_subscribed(struct mailbox_list *_list, @@ -353,13 +353,13 @@ { fs_list_alloc, fs_list_deinit, - fs_is_valid_mask, + fs_is_valid_pattern, fs_is_valid_existing_name, fs_is_valid_create_name, fs_list_get_path, fs_list_get_mailbox_name_status, fs_list_get_temp_prefix, - fs_list_join_refmask, + fs_list_join_refpattern, fs_list_iter_init, fs_list_iter_next, fs_list_iter_deinit,
--- a/src/lib-storage/list/mailbox-list-fs.h Fri Jun 29 19:26:27 2007 +0300 +++ b/src/lib-storage/list/mailbox-list-fs.h Fri Jun 29 19:41:22 2007 +0300 @@ -14,7 +14,7 @@ }; struct mailbox_list_iterate_context * -fs_list_iter_init(struct mailbox_list *_list, const char *mask, +fs_list_iter_init(struct mailbox_list *_list, const char *pattern, enum mailbox_list_iter_flags flags); int fs_list_iter_deinit(struct mailbox_list_iterate_context *ctx); const struct mailbox_info *
--- a/src/lib-storage/list/mailbox-list-maildir-iter.c Fri Jun 29 19:26:27 2007 +0300 +++ b/src/lib-storage/list/mailbox-list-maildir-iter.c Fri Jun 29 19:41:22 2007 +0300 @@ -62,7 +62,7 @@ (fname[1] == '\0' || (fname[1] == '.' && fname[2] == '\0'))) continue; - /* make sure the mask matches */ + /* make sure the pattern matches */ str_truncate(mailbox, 0); str_append(mailbox, ctx->prefix); str_append(mailbox, fname + 1); @@ -185,7 +185,7 @@ } struct mailbox_list_iterate_context * -maildir_list_iter_init(struct mailbox_list *_list, const char *mask, +maildir_list_iter_init(struct mailbox_list *_list, const char *pattern, enum mailbox_list_iter_flags flags) { struct maildir_list_iterate_context *ctx; @@ -200,7 +200,7 @@ ctx->pool = pool; ctx->tree_ctx = mailbox_tree_init(_list->hierarchy_sep); - glob = imap_match_init(pool, mask, TRUE, _list->hierarchy_sep); + glob = imap_match_init(pool, pattern, TRUE, _list->hierarchy_sep); ctx->dir = _list->set.root_dir; ctx->prefix = ""; @@ -214,12 +214,12 @@ return &ctx->ctx; } } else if ((_list->flags & MAILBOX_LIST_FLAG_FULL_FS_ACCESS) != 0 && - (p = strrchr(mask, '/')) != NULL) { + (p = strrchr(pattern, '/')) != NULL) { /* Listing non-default maildir */ - dir = t_strdup_until(mask, p); - ctx->prefix = p_strdup_until(pool, mask, p+1); + dir = t_strdup_until(pattern, p); + ctx->prefix = p_strdup_until(pool, pattern, p+1); - if (*mask != '/' && *mask != '~') + if (*pattern != '/' && *pattern != '~') dir = t_strconcat(_list->set.root_dir, "/", dir, NULL); ctx->dir = p_strdup(pool, home_expand(dir)); }
--- a/src/lib-storage/list/mailbox-list-maildir.c Fri Jun 29 19:26:27 2007 +0300 +++ b/src/lib-storage/list/mailbox-list-maildir.c Fri Jun 29 19:41:22 2007 +0300 @@ -91,8 +91,8 @@ } static bool __attr_noreturn__ -maildir_is_valid_mask(struct mailbox_list *list __attr_unused__, - const char *mask __attr_unused__) +maildir_is_valid_pattern(struct mailbox_list *list __attr_unused__, + const char *pattern __attr_unused__) { i_unreached(); #ifndef __attrs_used__ @@ -275,7 +275,7 @@ struct mailbox_list_iterate_context *iter; const struct mailbox_info *info; ARRAY_DEFINE(names_arr, const char *); - const char *mask, *oldpath, *newpath, *old_listname, *new_listname; + const char *pattern, *oldpath, *newpath, *old_listname, *new_listname; const char *const *names; unsigned int i, count; size_t oldnamelen; @@ -292,9 +292,9 @@ pool = pool_alloconly_create("Maildir++ children list", 1024); i_array_init(&names_arr, 64); - mask = t_strdup_printf("%s%c*", oldname, - mailbox_list_get_hierarchy_sep(list)); - iter = mailbox_list_iter_init(list, mask, + pattern = t_strdup_printf("%s%c*", oldname, + mailbox_list_get_hierarchy_sep(list)); + iter = mailbox_list_iter_init(list, pattern, MAILBOX_LIST_ITER_RETURN_NO_FLAGS); while ((info = mailbox_list_iter_next(iter)) != NULL) { const char *name; @@ -410,7 +410,7 @@ { maildir_list_alloc, maildir_list_deinit, - maildir_is_valid_mask, + maildir_is_valid_pattern, maildir_is_valid_existing_name, maildir_is_valid_create_name, maildir_list_get_path,
--- a/src/lib-storage/list/mailbox-list-maildir.h Fri Jun 29 19:26:27 2007 +0300 +++ b/src/lib-storage/list/mailbox-list-maildir.h Fri Jun 29 19:41:22 2007 +0300 @@ -14,7 +14,7 @@ }; struct mailbox_list_iterate_context * -maildir_list_iter_init(struct mailbox_list *_list, const char *mask, +maildir_list_iter_init(struct mailbox_list *_list, const char *pattern, enum mailbox_list_iter_flags flags); int maildir_list_iter_deinit(struct mailbox_list_iterate_context *ctx); const struct mailbox_info *
--- a/src/lib-storage/mailbox-list-private.h Fri Jun 29 19:26:27 2007 +0300 +++ b/src/lib-storage/mailbox-list-private.h Fri Jun 29 19:41:22 2007 +0300 @@ -10,7 +10,8 @@ struct mailbox_list *(*alloc)(void); void (*deinit)(struct mailbox_list *list); - bool (*is_valid_mask)(struct mailbox_list *list, const char *mask); + bool (*is_valid_pattern)(struct mailbox_list *list, + const char *pattern); bool (*is_valid_existing_name)(struct mailbox_list *list, const char *name); bool (*is_valid_create_name)(struct mailbox_list *list, @@ -23,11 +24,11 @@ enum mailbox_name_status *status); const char *(*get_temp_prefix)(struct mailbox_list *list); - const char *(*join_refmask)(struct mailbox_list *list, - const char *ref, const char *mask); + const char *(*join_refpattern)(struct mailbox_list *list, + const char *ref, const char *pattern); struct mailbox_list_iterate_context * - (*iter_init)(struct mailbox_list *list, const char *mask, + (*iter_init)(struct mailbox_list *list, const char *pattern, enum mailbox_list_iter_flags flags); const struct mailbox_info * (*iter_next)(struct mailbox_list_iterate_context *ctx);
--- a/src/lib-storage/mailbox-list.c Fri Jun 29 19:26:27 2007 +0300 +++ b/src/lib-storage/mailbox-list.c Fri Jun 29 19:41:22 2007 +0300 @@ -180,9 +180,10 @@ return list->ns; } -bool mailbox_list_is_valid_mask(struct mailbox_list *list, const char *mask) +bool mailbox_list_is_valid_pattern(struct mailbox_list *list, + const char *pattern) { - return list->v.is_valid_mask(list, mask); + return list->v.is_valid_pattern(list, pattern); } bool mailbox_list_is_valid_existing_name(struct mailbox_list *list, @@ -247,18 +248,18 @@ return list->v.get_temp_prefix(list); } -const char *mailbox_list_join_refmask(struct mailbox_list *list, - const char *ref, const char *mask) +const char *mailbox_list_join_refpattern(struct mailbox_list *list, + const char *ref, const char *pattern) { - if (list->v.join_refmask != NULL) - return list->v.join_refmask(list, ref, mask); + if (list->v.join_refpattern != NULL) + return list->v.join_refpattern(list, ref, pattern); /* the default implementation: */ if (*ref != '\0') { - /* merge reference and mask */ - mask = t_strconcat(ref, mask, NULL); + /* merge reference and pattern */ + pattern = t_strconcat(ref, pattern, NULL); } - return mask; + return pattern; } int mailbox_list_get_mailbox_name_status(struct mailbox_list *list, @@ -276,12 +277,12 @@ } struct mailbox_list_iterate_context * -mailbox_list_iter_init(struct mailbox_list *list, const char *mask, +mailbox_list_iter_init(struct mailbox_list *list, const char *pattern, enum mailbox_list_iter_flags flags) { mailbox_list_clear_error(list); - return list->v.iter_init(list, mask, flags); + return list->v.iter_init(list, pattern, flags); } const struct mailbox_info *
--- a/src/lib-storage/mailbox-list.h Fri Jun 29 19:26:27 2007 +0300 +++ b/src/lib-storage/mailbox-list.h Fri Jun 29 19:41:22 2007 +0300 @@ -127,7 +127,8 @@ /* Returns TRUE if the name doesn't contain any invalid characters. The create name check can be more strict. */ -bool mailbox_list_is_valid_mask(struct mailbox_list *list, const char *mask); +bool mailbox_list_is_valid_pattern(struct mailbox_list *list, + const char *pattern); bool mailbox_list_is_valid_existing_name(struct mailbox_list *list, const char *name); bool mailbox_list_is_valid_create_name(struct mailbox_list *list, @@ -154,14 +155,14 @@ with the namespace. */ const char *mailbox_list_get_temp_prefix(struct mailbox_list *list); -/* Returns a single mask from given reference and mask. */ -const char *mailbox_list_join_refmask(struct mailbox_list *list, - const char *ref, const char *mask); +/* Returns a single pattern from given reference and pattern. */ +const char *mailbox_list_join_refpattern(struct mailbox_list *list, + const char *ref, const char *pattern); -/* Initialize new mailbox list request. mask may contain '%' and '*' +/* Initialize new mailbox list request. pattern may contain '%' and '*' wildcards as defined by RFC-3501. */ struct mailbox_list_iterate_context * -mailbox_list_iter_init(struct mailbox_list *list, const char *mask, +mailbox_list_iter_init(struct mailbox_list *list, const char *pattern, enum mailbox_list_iter_flags flags); /* Get next mailbox. Returns the mailbox name */ const struct mailbox_info *