mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 09:00:13 +01:00
pilerimport can remove message from imap server
This commit is contained in:
parent
1e44042b82
commit
c02766a18c
@ -14,7 +14,7 @@
|
||||
|
||||
#define VERSION "0.1.25-master-branch"
|
||||
|
||||
#define BUILD 852
|
||||
#define BUILD 853
|
||||
|
||||
#define HOSTID "mailarchiver"
|
||||
|
||||
|
@ -255,6 +255,7 @@ struct import {
|
||||
int total_messages;
|
||||
int processed_messages;
|
||||
int import_job_id;
|
||||
int remove_after_import;
|
||||
time_t started, updated, finished;
|
||||
};
|
||||
|
||||
|
20
src/imap.c
20
src/imap.c
@ -226,9 +226,27 @@ int process_imap_folder(int sd, int *seq, char *folder, struct session_data *sda
|
||||
|
||||
|
||||
if(rc == ERR) printf("error importing '%s'\n", filename);
|
||||
else unlink(filename);
|
||||
else {
|
||||
|
||||
if(data->import->remove_after_import == 1){
|
||||
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);
|
||||
}
|
||||
|
||||
unlink(filename);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(data->import->remove_after_import == 1){
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
printf("\n");
|
||||
|
||||
return OK;
|
||||
|
@ -31,7 +31,6 @@ extern char *optarg;
|
||||
extern int optind;
|
||||
|
||||
int dryrun=0;
|
||||
int remove_after_successful_import = 0;
|
||||
int import_from_gui=0;
|
||||
|
||||
|
||||
@ -233,7 +232,7 @@ int import_from_maildir(char *directory, struct session_data *sdata, struct __da
|
||||
ret = ERR;
|
||||
}
|
||||
|
||||
if(remove_after_successful_import == 1 && ret != ERR) unlink(fname);
|
||||
if(data->import->remove_after_import == 1 && ret != ERR) unlink(fname);
|
||||
|
||||
i++;
|
||||
|
||||
@ -481,7 +480,7 @@ int main(int argc, char **argv){
|
||||
data.quiet = 0;
|
||||
|
||||
import.import_job_id = import.total_messages = import.processed_messages = 0;
|
||||
import.started = import.updated = import.finished = 0;
|
||||
import.started = import.updated = import.finished = import.remove_after_import = 0;
|
||||
|
||||
data.import = &import;
|
||||
|
||||
@ -585,7 +584,7 @@ int main(int argc, char **argv){
|
||||
break;
|
||||
|
||||
case 'r' :
|
||||
remove_after_successful_import = 1;
|
||||
data.import->remove_after_import = 1;
|
||||
break;
|
||||
|
||||
case 'G' :
|
||||
|
Loading…
Reference in New Issue
Block a user