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) ...@@ -55,26 +55,28 @@ dir_exists (const char *name, const char *suf)
55 static int 55 static int
56 _maildir_is_scheme (record_t record, const char *url) 56 _maildir_is_scheme (record_t record, const char *url)
57 { 57 {
58 const char *path;
59
58 if (!url || !record->scheme) 60 if (!url || !record->scheme)
59 return 0; 61 return 0;
60 62
61 if (strncmp (record->scheme, url, strlen (record->scheme)) == 0) 63 if (strncmp (record->scheme, url, strlen (record->scheme)) == 0)
62 return 1; 64 return 1;
63 65
64 if (strncmp (MU_PATH_SCHEME, url, MU_PATH_SCHEME_LEN) == 0) 66 if (mu_scheme_autodetect_p (url, &path))
65 { 67 {
66 /* Attemp auto-detection */ 68 /* Attemp auto-detection */
67 struct stat st; 69 struct stat st;
68 70
69 if (stat (url, &st) < 0) 71 if (stat (path, &st) < 0)
70 return 1; /* mailbox_open will complain */ 72 return 1; /* mailbox_open will complain */
71 73
72 if (!S_ISDIR (st.st_mode)) 74 if (!S_ISDIR (st.st_mode))
73 return 0; 75 return 0;
74 76
75 return dir_exists (url, TMPSUF) 77 return dir_exists (path, TMPSUF)
76 && dir_exists (url, CURSUF) 78 && dir_exists (path, CURSUF)
77 && dir_exists (url, NEWSUF); 79 && dir_exists (path, NEWSUF);
78 } 80 }
79 return 0; 81 return 0;
80 } 82 }
......