Commit 55f4e05b authored by Richard Curnow's avatar Richard Curnow

Allow '.' on the ends of message filenames for MH (work with Evolution)

Original rev  : rc@rc0.org.uk--2004-mairix/mairix--dev--0.17--patch-2
parent 983470d7
NEW IN VERSION 0.16.1
=====================
NEW IN VERSION 0.17
===================
* Update .PHONY target so that 'make install' etc are more reliable.
* Allow '.' on the ends of numeric filenames in MH folders (to work
with Evolution)
NEW IN VERSION 0.16.1
=====================
......
......@@ -117,14 +117,19 @@ static void get_maildir_message_paths(char *folder, struct msgpath_array *arr)/*
return;
}
/*}}}*/
int is_integer_string(char *x)/*{{{*/
int valid_mh_filename_p(char *x)/*{{{*/
{
char *p;
if (!*x) return 0; /* Must not be empty */
p = x;
while (*p) {
if (!isdigit(*p)) return 0;
if (!isdigit(*p)) {
/* Handle MH folders generated by Evolution, which have '.' on the ends
* of the numerical filenames for the messages. */
if ((p[0] == '.') && (p[1] == 0)) return 1;
else return 0;
}
p++;
}
return 1;
......@@ -147,7 +152,7 @@ static void get_mh_message_paths(char *folder, struct msgpath_array *arr)/*{{{*/
strcat(fname, de->d_name);
if (stat(fname, &sb) >= 0) {
if (S_ISREG(sb.st_mode)) {
if (is_integer_string(de->d_name)) {
if (valid_mh_filename_p(de->d_name)) {
add_file_to_list(fname, sb.st_mtime, sb.st_size, arr);
}
}
......
......@@ -266,7 +266,7 @@ unsigned int hashfn( unsigned char *k, unsigned int length, unsigned int initval
/* In dirscan.c */
struct msgpath_array *new_msgpath_array(void);
int is_integer_string(char *x);
int valid_mh_filename_p(char *x);
void free_msgpath_array(struct msgpath_array *x);
void string_list_to_array(struct string_list *list, int *n, char ***arr);
void split_on_colons(const char *str, int *n, char ***arr);
......
......@@ -1169,7 +1169,7 @@ static void clear_mh_folder(char *path)/*{{{*/
d = opendir(path);
if (d) {
while ((de = readdir(d))) {
if (is_integer_string(de->d_name)) {
if (valid_mh_filename_p(de->d_name)) {
strcpy(fpath, path);
strcat(fpath, "/");
strcat(fpath, de->d_name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment