Commit 831b1e65 831b1e6555af866d201df6e4951f42eb1e96a658 by Sergey Poznyakoff

(_mh_is_scheme): Use mu_scheme_autodetect_p().

1 parent b1decbb5
...@@ -86,24 +86,26 @@ mh_dir_p (const char *name) ...@@ -86,24 +86,26 @@ mh_dir_p (const char *name)
86 static int 86 static int
87 _mh_is_scheme (record_t record, const char *url) 87 _mh_is_scheme (record_t record, const char *url)
88 { 88 {
89 const char *path;
90
89 if (!url || !record->scheme) 91 if (!url || !record->scheme)
90 return 0; 92 return 0;
91 93
92 if (strncmp (record->scheme, url, strlen (record->scheme)) == 0) 94 if (strncmp (record->scheme, url, strlen (record->scheme)) == 0)
93 return 1; 95 return 1;
94 96
95 if (strncmp (MU_PATH_SCHEME, url, MU_PATH_SCHEME_LEN) == 0) 97 if (mu_scheme_autodetect_p (url, &path))
96 { 98 {
97 /* Attemp auto-detection */ 99 /* Attemp auto-detection */
98 struct stat st; 100 struct stat st;
99 101
100 if (stat (url, &st) < 0) 102 if (stat (path, &st) < 0)
101 return 1; /* mailbox_open will complain */ 103 return 1; /* mailbox_open will complain */
102 104
103 if (!S_ISDIR (st.st_mode)) 105 if (!S_ISDIR (st.st_mode))
104 return 0; 106 return 0;
105 107
106 return mh_dir_p (url); 108 return mh_dir_p (path);
107 } 109 }
108 110
109 return 0; 111 return 0;
......