summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2019-03-26 20:18:41 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2019-03-26 20:18:41 (GMT)
commit9f7eb0a63d0c8e406636c9ad9f0d12aeb5ca077c (patch) (side-by-side diff)
tree541d1dcbfe9661abd030b3d5c229cdaaa748afac
parent60c5545ba8a5c9f4038b5587c96c19b80f538831 (diff)
downloadmailutils-9f7eb0a63d0c8e406636c9ad9f0d12aeb5ca077c.tar.gz
mailutils-9f7eb0a63d0c8e406636c9ad9f0d12aeb5ca077c.tar.bz2
Use mu_folder_scan in imap4d
* imap4d/list.c (list_fun): Don't check if the returned record matches refinfo->pfx->record. This is done by mu_folder_scan. (list_ref): Use mu_folder_scan.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--imap4d/list.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/imap4d/list.c b/imap4d/list.c
index 5b4dbd1..b2752f7 100644
--- a/imap4d/list.c
+++ b/imap4d/list.c
@@ -36,11 +36,6 @@ list_fun (mu_folder_t folder, struct mu_list_response *resp, void *data)
size_t size;
char *p;
- if ((resp->type & MU_FOLDER_ATTRIBUTE_FILE)
- && refinfo->pfx->record
- && refinfo->pfx->record != resp->format)
- return 0;
-
name = resp->name + refinfo->dirlen;
/* There can be only one INBOX */
@@ -126,6 +121,7 @@ list_ref (char const *ref, char const *wcard, char const *cwd,
mu_folder_t folder;
char const *dir;
mu_url_t url;
+ struct mu_folder_scanner scn = MU_FOLDER_SCANNER_INITIALIZER;
if (!wcard[0])
{
@@ -192,9 +188,18 @@ list_ref (char const *ref, char const *wcard, char const *cwd,
if (!*ref &&
mu_imap_wildmatch_ci (wcard, "INBOX", MU_HIERARCHY_DELIMITER) == 0)
io_untagged_response (RESP_NONE, "LIST (\\NoInferiors) NIL INBOX");
+
+ scn.pattern = (void*) wcard;
+ scn.enumfun = list_fun;
+ scn.enumdata = &refinfo;
+ if (refinfo.pfx->record)
+ {
+ mu_list_create (&scn.records);
+ mu_list_append (scn.records, refinfo.pfx->record);
+ }
- mu_folder_enumerate (folder, NULL, (void*) wcard, 0, 0, NULL,
- list_fun, &refinfo);
+ mu_folder_scan (folder, &scn);
+ mu_list_destroy (&scn.records);
mu_folder_destroy (&folder);
free (refinfo.buf);
return RESP_OK;

Return to:

Send suggestions and report system problems to the System administrator.