Minor fix.
* imap4d/list.c (list_ref): Use mu_imap_wildmatch_ci to check for a request matching INBOX. * include/mailutils/imaputil.h (mu_imap_wildmatch_ci): New prototype. * libmailutils/imapio/wildmatch.c (mu_imap_wildmatch_ci): New function.
Showing
3 changed files
with
16 additions
and
9 deletions
... | @@ -171,8 +171,7 @@ list_ref (char const *ref, char const *wcard, char const *cwd, | ... | @@ -171,8 +171,7 @@ list_ref (char const *ref, char const *wcard, char const *cwd, |
171 | on this or some other server. */ | 171 | on this or some other server. */ |
172 | 172 | ||
173 | if (!*ref && | 173 | if (!*ref && |
174 | (mu_imap_wildmatch (wcard, "INBOX", MU_HIERARCHY_DELIMITER) == 0 | 174 | mu_imap_wildmatch_ci (wcard, "INBOX", MU_HIERARCHY_DELIMITER) == 0) |
175 | || mu_imap_wildmatch (wcard, "inbox", MU_HIERARCHY_DELIMITER) == 0)) | ||
176 | io_untagged_response (RESP_NONE, "LIST (\\NoInferiors) NIL INBOX"); | 175 | io_untagged_response (RESP_NONE, "LIST (\\NoInferiors) NIL INBOX"); |
177 | 176 | ||
178 | mu_folder_enumerate (folder, NULL, (void*) wcard, 0, 0, NULL, | 177 | mu_folder_enumerate (folder, NULL, (void*) wcard, 0, 0, NULL, | ... | ... |
... | @@ -24,9 +24,10 @@ extern "C" { | ... | @@ -24,9 +24,10 @@ extern "C" { |
24 | # include <mailutils/types.h> | 24 | # include <mailutils/types.h> |
25 | 25 | ||
26 | int mu_imap_wildmatch (const char *pattern, const char *name, int delim); | 26 | int mu_imap_wildmatch (const char *pattern, const char *name, int delim); |
27 | int mu_imap_wildmatch_ci (const char *pattern, const char *name, int delim); | ||
27 | 28 | ||
28 | int mu_imap_flag_to_attribute (const char *item, int *attr); | 29 | int mu_imap_flag_to_attribute (const char *item, int *attr); |
29 | int mu_imap_format_flags (mu_stream_t str, int flags, int include_recent); | 30 | int mu_imap_format_flags (mu_stream_t str, int flags, int include_recent); |
30 | 31 | ||
31 | #ifdef __cplusplus | 32 | #ifdef __cplusplus |
32 | } | 33 | } | ... | ... |
... | @@ -18,6 +18,7 @@ | ... | @@ -18,6 +18,7 @@ |
18 | #include <string.h> | 18 | #include <string.h> |
19 | #include <mailutils/types.h> | 19 | #include <mailutils/types.h> |
20 | #include <mailutils/imaputil.h> | 20 | #include <mailutils/imaputil.h> |
21 | #include <mailutils/cctype.h> | ||
21 | 22 | ||
22 | /* Match STRING against the IMAP4 wildcard pattern PATTERN. */ | 23 | /* Match STRING against the IMAP4 wildcard pattern PATTERN. */ |
23 | 24 | ||
... | @@ -26,7 +27,7 @@ | ... | @@ -26,7 +27,7 @@ |
26 | #define WILD_ABORT 2 | 27 | #define WILD_ABORT 2 |
27 | 28 | ||
28 | int | 29 | int |
29 | _wild_match (const char *pat, const char *name, char delim) | 30 | _wild_match (const char *pat, const char *name, char delim, int icase) |
30 | { | 31 | { |
31 | while (pat && *pat) | 32 | while (pat && *pat) |
32 | { | 33 | { |
... | @@ -41,7 +42,7 @@ _wild_match (const char *pat, const char *name, char delim) | ... | @@ -41,7 +42,7 @@ _wild_match (const char *pat, const char *name, char delim) |
41 | return WILD_TRUE; | 42 | return WILD_TRUE; |
42 | while (*name) | 43 | while (*name) |
43 | { | 44 | { |
44 | int res = _wild_match (pat, name++, delim); | 45 | int res = _wild_match (pat, name++, delim, icase); |
45 | if (res != WILD_FALSE) | 46 | if (res != WILD_FALSE) |
46 | return res; | 47 | return res; |
47 | } | 48 | } |
... | @@ -54,14 +55,15 @@ _wild_match (const char *pat, const char *name, char delim) | ... | @@ -54,14 +55,15 @@ _wild_match (const char *pat, const char *name, char delim) |
54 | return strchr (name, delim) ? WILD_FALSE : WILD_TRUE; | 55 | return strchr (name, delim) ? WILD_FALSE : WILD_TRUE; |
55 | while (*name && *name != delim) | 56 | while (*name && *name != delim) |
56 | { | 57 | { |
57 | int res = _wild_match (pat, name++, delim); | 58 | int res = _wild_match (pat, name++, delim, icase); |
58 | if (res != WILD_FALSE) | 59 | if (res != WILD_FALSE) |
59 | return res; | 60 | return res; |
60 | } | 61 | } |
61 | return _wild_match (pat, name, delim); | 62 | return _wild_match (pat, name, delim, icase); |
62 | 63 | ||
63 | default: | 64 | default: |
64 | if (*pat != *name) | 65 | if (icase ? mu_toupper (*pat) != mu_toupper (*name) |
66 | : *pat != *name) | ||
65 | return WILD_FALSE; | 67 | return WILD_FALSE; |
66 | pat++; | 68 | pat++; |
67 | name++; | 69 | name++; |
... | @@ -73,6 +75,11 @@ _wild_match (const char *pat, const char *name, char delim) | ... | @@ -73,6 +75,11 @@ _wild_match (const char *pat, const char *name, char delim) |
73 | int | 75 | int |
74 | mu_imap_wildmatch (const char *pattern, const char *name, int delim) | 76 | mu_imap_wildmatch (const char *pattern, const char *name, int delim) |
75 | { | 77 | { |
76 | return _wild_match (pattern, name, delim) != WILD_TRUE; | 78 | return _wild_match (pattern, name, delim, 0) != WILD_TRUE; |
77 | } | 79 | } |
78 | 80 | ||
81 | int | ||
82 | mu_imap_wildmatch_ci (const char *pattern, const char *name, int delim) | ||
83 | { | ||
84 | return _wild_match (pattern, name, delim, 1) != WILD_TRUE; | ||
85 | } | ... | ... |
-
Please register or sign in to post a comment