Dear piler users,

an odd bug has been discovered in the imap import feature of piler, see
https://bitbucket.org/jsuto/piler/issues/593/emails-are-removed-from-imap-server-when
for more.

Workaround:

Do NOT use -r with -D


Fix:

Apply the following patch to src/imap.c


diff --git a/src/imap.c b/src/imap.c
index b41dcf8..bff1795 100644
--- a/src/imap.c
+++ b/src/imap.c
@@ -248,7 +248,7 @@ int process_imap_folder(int sd, int *seq, char *folder, struct session_data *sda
       if(rc == ERR) printf("error importing '%s'\n", filename);
       else {

-         if(data->import->remove_after_import == 1){
+         if(data->import->remove_after_import == 1 && dryrun == 0){
snprintf(buf, sizeof(buf)-1, "A%d STORE %d +FLAGS.SILENT (\\Deleted)\r\n", *seq, i);
             n = write1(sd, buf, strlen(buf), use_ssl, data->ssl);
             read_response(sd, buf, sizeof(buf), seq, data, use_ssl);
@@ -260,7 +260,7 @@ int process_imap_folder(int sd, int *seq, char *folder, struct session_data *sda

    }

-   if(data->import->remove_after_import == 1){
+   if(data->import->remove_after_import == 1 && dryrun == 0){
       snprintf(buf, sizeof(buf)-1, "A%d EXPUNGE\r\n", *seq);
       n = write1(sd, buf, strlen(buf), use_ssl, data->ssl);
       read_response(sd, buf, sizeof(buf), seq, data, use_ssl);


I'll push the fix to the master branch soon.


Janos

Reply via email to