path: root/libmailutils/url
diff options
authorSergey Poznyakoff <>2019-03-02 12:18:11 +0200
committerSergey Poznyakoff <>2019-03-02 12:36:06 +0200
commit1ed195f6b39a8ded621ebb00b04b0418b8cc4e8f (patch)
tree8af5039d1718a083821755329a3587f1c842acdf /libmailutils/url
parent169099f43bfd1a45398139c27df5ebc4375f6a7d (diff)
Implement different accuracy levels for the mailbox format detection
Selecting the accuracy level allows the user to achieve the desired balance between the speed of the folder scan and accuracy of mailbox format detection. The accuracy level can be set either from the configuration file, using the mailbox.accuracy-level statement, or from the environment, using the MU_AUTODETECT_ACCURACY variable. The default accuracy level 1 discerns valid mbox and dotmail mailboxes providing reasonable scan speed. Level 0 (previous default) does not discern them, but provides maximal speed. Level 2 and higher provide better accuracy at the price of speed. * include/mailutils/url.h (MU_AUTODETECT_ACCURACY_AUTO) (MU_AUTODETECT_ACCURACY_FAST) (MU_AUTODETECT_ACCURACY_DEFAULT): New constants. (mu_scheme_autodetect_p): New proto, moved here from util.h (mu_set_autodetect_accuracy) (mu_autodetect_accuracy): New protos. * libmailutils/base/schemeauto.c (mu_set_autodetect_accuracy) mu_autodetect_accuracy): New functions. * libmailutils/cli/stdcapa.c: New configuration statement: mailbox.autodetect-accuracy. * libmailutils/url/create.c (_mu_url_create_internal): Assume the "file" scheme if the MU_URL_PARSE_LOCAL flag is set. * libproto/dotmail/folder.c: Implement format detection. Three accuracy levels: 0, 1, and >1 * libproto/mbox/folder.c (_mbox_is_scheme): Implement default format detection. * libproto/dotmail/tests/ Add new test. * libproto/dotmail/tests/ New test. * libproto/dotmail/tests/dm_detect.c: New file. * libproto/dotmail/tests/ Add new test.
Diffstat (limited to 'libmailutils/url')
1 files changed, 5 insertions, 1 deletions
diff --git a/libmailutils/url/create.c b/libmailutils/url/create.c
index 3b19a4f2c..5d1d0c501 100644
--- a/libmailutils/url/create.c
+++ b/libmailutils/url/create.c
@@ -457,7 +457,11 @@ _mu_url_create_internal (struct mu_url_ctx *ctx, mu_url_t hint)
url->flags |= MU_URL_PATH;
- rc = _mu_url_ctx_parse (ctx);
+ {
+ if (ctx->flags & MU_URL_PARSE_LOCAL)
+ scheme = "file";
+ rc = _mu_url_ctx_parse (ctx);
+ }
if (rc)
return rc;

Return to:

Send suggestions and report system problems to the System administrator.