]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Added "auto" mail storage driver for forcing autodetection.
authorTimo Sirainen <tss@iki.fi>
Tue, 15 Nov 2011 16:21:39 +0000 (18:21 +0200)
committerTimo Sirainen <tss@iki.fi>
Tue, 15 Nov 2011 16:21:39 +0000 (18:21 +0200)
src/lib-storage/mail-storage.c

index b3e52cc4c644f69d3c850c100a9a73efe211d069..f9173ad6cd7bee11130d2f10fbb81b15d2cff327 100644 (file)
@@ -132,7 +132,15 @@ mail_storage_get_class(struct mail_namespace *ns, const char *driver,
        struct mail_storage *storage_class = NULL;
        const char *home;
 
-       if (driver != NULL) {
+       if (driver == NULL) {
+               /* no mail_location, autodetect */
+       } else if (strcmp(driver, "auto") == 0) {
+               /* explicit autodetection with "auto" driver. */
+               if (*list_set->root_dir == '\0') {
+                       /* handle the same as with driver=NULL */
+                       list_set->root_dir = NULL;
+               }
+       } else {
                storage_class = mail_storage_find_class(driver);
                if (storage_class == NULL) {
                        *error_r = t_strdup_printf(