added start position option for pop3 imports

This commit is contained in:
SJ 2014-09-03 11:39:52 +02:00
parent 977744d757
commit 9b279af0c6
4 changed files with 17 additions and 5 deletions

View File

@ -12,9 +12,9 @@
#define PROGNAME "piler" #define PROGNAME "piler"
#define PILERGETD_PROGNAME "pilergetd" #define PILERGETD_PROGNAME "pilergetd"
#define VERSION "1.1.1-rc1" #define VERSION "1.2.0-pre"
#define BUILD 886 #define BUILD 887
#define HOSTID "mailarchiver" #define HOSTID "mailarchiver"

View File

@ -270,6 +270,7 @@ struct import {
int total_messages; int total_messages;
int processed_messages; int processed_messages;
int batch_processing_limit; int batch_processing_limit;
int start_position;
int import_job_id; int import_job_id;
int remove_after_import; int remove_after_import;
int keep_eml; int keep_eml;

View File

@ -488,6 +488,7 @@ int main(int argc, char **argv){
import.import_job_id = import.total_messages = import.total_size = import.processed_messages = import.batch_processing_limit = 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.started = import.updated = import.finished = import.remove_after_import = 0;
import.extra_recipient = NULL; import.extra_recipient = NULL;
import.start_position = 1;
data.import = &import; data.import = &import;
@ -515,6 +516,7 @@ int main(int argc, char **argv){
{"folder_imap", required_argument, 0, 'f' }, {"folder_imap", required_argument, 0, 'f' },
{"add-recipient",required_argument, 0, 'a' }, {"add-recipient",required_argument, 0, 'a' },
{"batch-limit", required_argument, 0, 'b' }, {"batch-limit", required_argument, 0, 'b' },
{"start-position",required_argument, 0, 's' },
{"quiet", no_argument, 0, 'q' }, {"quiet", no_argument, 0, 'q' },
{"recursive", required_argument, 0, 'R' }, {"recursive", required_argument, 0, 'R' },
{"remove-after-import",no_argument, 0, 'r' }, {"remove-after-import",no_argument, 0, 'r' },
@ -526,9 +528,9 @@ int main(int argc, char **argv){
int option_index = 0; int option_index = 0;
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); c = getopt_long(argc, argv, "c:m:M:e:d:i:K:u:p:P:x:F:f:a:b:s:GDRrqh?", long_options, &option_index);
#else #else
c = getopt(argc, argv, "c:m:M:e:d:i:K:u:p:P:x:F:f:a:b:GDRrqh?"); c = getopt(argc, argv, "c:m:M:e:d:i:K:u:p:P:x:F:f:a:b:s:GDRrqh?");
#endif #endif
if(c == -1) break; if(c == -1) break;
@ -605,6 +607,15 @@ int main(int argc, char **argv){
data.import->batch_processing_limit = atoi(optarg); data.import->batch_processing_limit = atoi(optarg);
break; break;
case 's' :
if(atoi(optarg) < 1){
printf("invalid start position: %s\n", optarg);
return -1;
}
data.import->start_position = atoi(optarg);
break;
case 'a' : case 'a' :
data.import->extra_recipient = optarg; data.import->extra_recipient = optarg;
break; break;

View File

@ -120,7 +120,7 @@ int process_pop3_emails(int sd, struct session_data *sdata, struct __data *data,
if(data->import->total_messages <= 0) return OK; if(data->import->total_messages <= 0) return OK;
for(i=1; i<=data->import->total_messages; i++){ for(i=data->import->start_position; i<=data->import->total_messages; i++){
data->import->processed_messages++; data->import->processed_messages++;
printf("processed: %7d\r", data->import->processed_messages); fflush(stdout); printf("processed: %7d\r", data->import->processed_messages); fflush(stdout);