From 560178f458aa166853a0cd63d2ab4b26c1747219 Mon Sep 17 00:00:00 2001 From: SJ Date: Thu, 24 Jan 2013 09:54:20 +0100 Subject: [PATCH] issue a warning and keep the message if it cannot be imported --- src/imap.c | 3 ++- src/pilerimport.c | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/imap.c b/src/imap.c index 608c6dc3..7d3b172b 100644 --- a/src/imap.c +++ b/src/imap.c @@ -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); - unlink(filename); + if(rc == ERR) printf("error importing '%s'\n", filename); + else unlink(filename); } printf("\n"); diff --git a/src/pilerimport.c b/src/pilerimport.c index 1381b3bb..9cac45d7 100644 --- a/src/pilerimport.c +++ b/src/pilerimport.c @@ -62,8 +62,11 @@ int import_from_mailbox(char *mailbox, struct session_data *sdata, struct __data fclose(f); f = NULL; rc = import_message(fname, sdata, data, cfg); - if(rc == ERR) ret = ERR; - unlink(fname); + if(rc == ERR){ + printf("error importing: '%s'\n", fname); + ret = ERR; + } + else unlink(fname); 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){ fclose(f); rc = import_message(fname, sdata, data, cfg); - if(rc == ERR) ret = ERR; - unlink(fname); + if(rc == ERR){ + printf("error importing: '%s'\n", fname); + ret = ERR; + } + else unlink(fname); 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); 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); i++;