issue a warning and keep the message if it cannot be imported

This commit is contained in:
SJ 2013-01-24 09:54:20 +01:00
parent c6d4cf051d
commit 560178f458
2 changed files with 17 additions and 7 deletions

View File

@ -181,7 +181,8 @@ int process_imap_folder(int sd, int *seq, char *folder, struct session_data *sda
rc = import_message(filename, sdata, data, cfg); rc = import_message(filename, sdata, data, cfg);
unlink(filename); if(rc == ERR) printf("error importing '%s'\n", filename);
else unlink(filename);
} }
printf("\n"); printf("\n");

View File

@ -62,8 +62,11 @@ int import_from_mailbox(char *mailbox, struct session_data *sdata, struct __data
fclose(f); fclose(f);
f = NULL; f = NULL;
rc = import_message(fname, sdata, data, cfg); rc = import_message(fname, sdata, data, cfg);
if(rc == ERR) ret = ERR; if(rc == ERR){
unlink(fname); printf("error importing: '%s'\n", fname);
ret = ERR;
}
else unlink(fname);
if(quiet == 0) printf("processed: %7d\r", tot_msgs); fflush(stdout); if(quiet == 0) printf("processed: %7d\r", tot_msgs); fflush(stdout);
} }
@ -79,8 +82,11 @@ int import_from_mailbox(char *mailbox, struct session_data *sdata, struct __data
if(f){ if(f){
fclose(f); fclose(f);
rc = import_message(fname, sdata, data, cfg); rc = import_message(fname, sdata, data, cfg);
if(rc == ERR) ret = ERR; if(rc == ERR){
unlink(fname); printf("error importing: '%s'\n", fname);
ret = ERR;
}
else unlink(fname);
if(quiet == 0) printf("processed: %7d\r", tot_msgs); fflush(stdout); if(quiet == 0) printf("processed: %7d\r", tot_msgs); fflush(stdout);
} }
@ -215,8 +221,11 @@ int import_from_maildir(char *directory, struct session_data *sdata, struct __da
rc = import_message(fname, sdata, data, cfg); rc = import_message(fname, sdata, data, cfg);
if(rc == OK) (*tot_msgs)++; if(rc == OK) (*tot_msgs)++;
else ret = ERR; else {
printf("error importing: '%s'\n", fname);
ret = ERR;
}
if(remove_after_successful_import == 1 && ret != ERR) unlink(fname); if(remove_after_successful_import == 1 && ret != ERR) unlink(fname);
i++; i++;