summaryrefslogtreecommitdiff
path: root/examples/lsf.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2007-12-21 22:06:39 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2007-12-21 22:06:39 +0000
commitb9ef5553104e1125d305c828017394c40941b19a (patch)
treeae16b8ff742a21c18b0f1b27e22e425549693b3c /examples/lsf.c
parent6d490ce129c98caddf5db5601094497a375f47e7 (diff)
downloadmailutils-b9ef5553104e1125d305c828017394c40941b19a.tar.gz
mailutils-b9ef5553104e1125d305c828017394c40941b19a.tar.bz2
* examples/lsf.c: Use mu_folder_enumerate + callback function, for
speed up. * imap4d/imap4d.h (WCARD_NOMATCH,WCARD_MATCH) (WCARD_RECURSE_MATCH): Remove. * imap4d/list.c: Rewrite using mu_folder_enumerate. * imap4d/lsub.c (imap4d_lsub): Fix call to util_wcard_match. * imap4d/util.c (util_wcard_match): Return 0 for match, 1 otherwise. * imap4d/testsuite/imap4d/list.exp: Fix two testcases to match the new (stricter RFC-compliant) behavior. * include/mailutils/folder.h (mu_folder_match_fp): New typedef. (mu_folder_enumerate_fp): New typedef. (mu_folder_enumerate): New function. (mu_folder_set_match, mu_folder_get_match): New functions. * libproto/imap/folder.c, libproto/include/imap0.h, libproto/nntp/folder.c : Use new folder list framework. * libproto/include/folder0.h (struct _mu_folder._list): Change signature. (_match): New member. * libproto/mbox/folder.c (_path_is_scheme): Improve automatic mailbox format detection. (folder_mbox_list): Do not use glob, recursively scan subdirectories instead. * mailbox/folder.c (mu_folder_match): New function. (mu_folder_create_from_record): Set mu_folder_match as the default matcher. (mu_folder_set_match, mu_folder_get_match): New functions. (mu_folder_enumerate): New function. (mu_folder_list): Rewrite using mu_folder_enumerate.
Diffstat (limited to 'examples/lsf.c')
-rw-r--r--examples/lsf.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/examples/lsf.c b/examples/lsf.c
index 6a1d31d49..52c9cf661 100644
--- a/examples/lsf.c
+++ b/examples/lsf.c
@@ -25,10 +25,8 @@
#include <mailutils/mailutils.h>
static int
-ls_printer (void *item, void *data)
+enumfun (mu_folder_t folder, struct mu_list_response *resp, void *data)
{
- struct mu_list_response *resp = item;
-
printf ("%c%c %c %4d %s\n",
(resp->type & MU_FOLDER_ATTRIBUTE_DIRECTORY) ? 'd' : '-',
(resp->type & MU_FOLDER_ATTRIBUTE_FILE) ? 'f' : '-',
@@ -60,13 +58,14 @@ ls_folders (char *fname, char *ref, char *pattern, int level)
return 1;
}
- status = mu_folder_list (folder, ref, pattern, level, &flist);
+ status = mu_folder_enumerate (folder, ref, pattern, 0, level, &flist,
+ enumfun, NULL);
+
switch (status)
{
case 0:
mu_list_count (flist, &count);
printf ("Number of folders: %lu\n", (unsigned long) count);
- mu_list_do (flist, ls_printer, NULL);
mu_list_destroy (&flist);
break;
case MU_ERR_NOENT:
@@ -105,7 +104,5 @@ main (int argc, char *argv[])
mu_register_all_mbox_formats ();
- if (!ref)
- ref = folder;
return ls_folders (folder, ref, pattern, level);
}

Return to:

Send suggestions and report system problems to the System administrator.