Commit b1decbb5 b1decbb5cdb05ca64fb29d4482362f38060ca8db by Sergey Poznyakoff

(_maildir_is_scheme): Use mu_scheme_autodetect_p().

1 parent 76017b8e
......@@ -55,26 +55,28 @@ dir_exists (const char *name, const char *suf)
static int
_maildir_is_scheme (record_t record, const char *url)
{
const char *path;
if (!url || !record->scheme)
return 0;
if (strncmp (record->scheme, url, strlen (record->scheme)) == 0)
return 1;
if (strncmp (MU_PATH_SCHEME, url, MU_PATH_SCHEME_LEN) == 0)
if (mu_scheme_autodetect_p (url, &path))
{
/* Attemp auto-detection */
struct stat st;
if (stat (url, &st) < 0)
if (stat (path, &st) < 0)
return 1; /* mailbox_open will complain */
if (!S_ISDIR (st.st_mode))
return 0;
return dir_exists (url, TMPSUF)
&& dir_exists (url, CURSUF)
&& dir_exists (url, NEWSUF);
return dir_exists (path, TMPSUF)
&& dir_exists (path, CURSUF)
&& dir_exists (path, NEWSUF);
}
return 0;
}
......