diff --git a/src/config.h b/src/config.h index dec29f83..af0612fc 100644 --- a/src/config.h +++ b/src/config.h @@ -12,9 +12,9 @@ #define PROGNAME "piler" #define PILERGETD_PROGNAME "pilergetd" -#define VERSION "1.1.1" +#define VERSION "1.1.1-rc1" -#define BUILD 885 +#define BUILD 886 #define HOSTID "mailarchiver" diff --git a/src/defs.h b/src/defs.h index e5118bba..4faef028 100644 --- a/src/defs.h +++ b/src/defs.h @@ -269,6 +269,7 @@ struct import { int status; int total_messages; int processed_messages; + int batch_processing_limit; int import_job_id; int remove_after_import; int keep_eml; diff --git a/src/pilerimport.c b/src/pilerimport.c index 2f0d5b24..f965589b 100644 --- a/src/pilerimport.c +++ b/src/pilerimport.c @@ -484,7 +484,8 @@ int main(int argc, char **argv){ data.recursive_folder_names = 0; data.quiet = 0; - import.import_job_id = import.total_messages = import.total_size = import.processed_messages = 0; + + import.import_job_id = import.total_messages = import.total_size = import.processed_messages = import.batch_processing_limit = 0; import.started = import.updated = import.finished = import.remove_after_import = 0; import.extra_recipient = NULL; @@ -513,6 +514,7 @@ int main(int argc, char **argv){ {"folder", required_argument, 0, 'F' }, {"folder_imap", required_argument, 0, 'f' }, {"add-recipient",required_argument, 0, 'a' }, + {"batch-limit", required_argument, 0, 'b' }, {"quiet", no_argument, 0, 'q' }, {"recursive", required_argument, 0, 'R' }, {"remove-after-import",no_argument, 0, 'r' }, @@ -524,9 +526,9 @@ int main(int argc, char **argv){ int option_index = 0; - c = getopt_long(argc, argv, "c:m:M:e:d:i:K:u:p:P:x:F:f:a:GDRrqh?", long_options, &option_index); + c = getopt_long(argc, argv, "c:m:M:e:d:i:K:u:p:P:x:F:f:a:b:GDRrqh?", long_options, &option_index); #else - c = getopt(argc, argv, "c:m:M:e:d:i:K:u:p:P:x:F:f:a:GDRrqh?"); + c = getopt(argc, argv, "c:m:M:e:d:i:K:u:p:P:x:F:f:a:b:GDRrqh?"); #endif if(c == -1) break; @@ -599,6 +601,10 @@ int main(int argc, char **argv){ data.import->remove_after_import = 1; break; + case 'b' : + data.import->batch_processing_limit = atoi(optarg); + break; + case 'a' : data.import->extra_recipient = optarg; break; diff --git a/src/pop3.c b/src/pop3.c index e0d94f94..2909451b 100644 --- a/src/pop3.c +++ b/src/pop3.c @@ -209,6 +209,13 @@ int process_pop3_emails(int sd, struct session_data *sdata, struct __data *data, } unlink(filename); + + + /* whether to quit after processing a batch of messages */ + + if(data->import->batch_processing_limit > 0 && data->import->processed_messages >= data->import->batch_processing_limit){ + break; + } }