mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-24 19:20:12 +01:00
make pilerimport quiet with -q
This commit is contained in:
parent
e298d2b9c0
commit
187503887a
@ -258,7 +258,7 @@ struct import {
|
||||
|
||||
|
||||
struct __data {
|
||||
int folder;
|
||||
int folder, quiet;
|
||||
char recursive_folder_names;
|
||||
char starttls[TINYBUFSIZE];
|
||||
struct node *mydomains[MAXHASH];
|
||||
|
@ -84,7 +84,7 @@ int import_message(char *filename, struct session_data *sdata, struct __data *da
|
||||
rule = check_againt_ruleset(data->archiving_rules, &state, sdata->tot_len, sdata->spam_message);
|
||||
|
||||
if(rule){
|
||||
printf("discarding %s by archiving policy: %s\n", filename, rule);
|
||||
if(data->quiet == 0) printf("discarding %s by archiving policy: %s\n", filename, rule);
|
||||
rc = OK;
|
||||
}
|
||||
else {
|
||||
@ -119,7 +119,7 @@ int import_message(char *filename, struct session_data *sdata, struct __data *da
|
||||
counters.c_duplicate = 1;
|
||||
update_counters(sdata, data, &counters, cfg);
|
||||
|
||||
printf("duplicate: %s (id: %s)\n", filename, sdata->ttmpfile);
|
||||
if(data->quiet == 0)printf("duplicate: %s (id: %s)\n", filename, sdata->ttmpfile);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -30,7 +30,6 @@
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
|
||||
int quiet=0;
|
||||
int dryrun=0;
|
||||
int remove_after_successful_import = 0;
|
||||
int import_from_gui=0;
|
||||
@ -76,7 +75,7 @@ int import_from_mailbox(char *mailbox, struct session_data *sdata, struct __data
|
||||
}
|
||||
else unlink(fname);
|
||||
|
||||
if(quiet == 0) printf("processed: %7d\r", tot_msgs); fflush(stdout);
|
||||
if(data->quiet == 0) printf("processed: %7d\r", tot_msgs); fflush(stdout);
|
||||
}
|
||||
|
||||
snprintf(fname, sizeof(fname)-1, "%ld-%d", t, tot_msgs);
|
||||
@ -96,7 +95,7 @@ int import_from_mailbox(char *mailbox, struct session_data *sdata, struct __data
|
||||
}
|
||||
else unlink(fname);
|
||||
|
||||
if(quiet == 0) printf("processed: %7d\r", tot_msgs); fflush(stdout);
|
||||
if(data->quiet == 0) printf("processed: %7d\r", tot_msgs); fflush(stdout);
|
||||
}
|
||||
|
||||
fclose(F);
|
||||
@ -238,7 +237,7 @@ int import_from_maildir(char *directory, struct session_data *sdata, struct __da
|
||||
|
||||
i++;
|
||||
|
||||
if(quiet == 0) printf("processed: %7d\r", *tot_msgs); fflush(stdout);
|
||||
if(data->quiet == 0) printf("processed: %7d\r", *tot_msgs); fflush(stdout);
|
||||
}
|
||||
else {
|
||||
printf("%s is not a file\n", fname);
|
||||
@ -316,10 +315,10 @@ int import_from_imap_server(char *server, char *username, char *password, int po
|
||||
}
|
||||
|
||||
if(skipmatch == 1){
|
||||
if(quiet == 0) printf("SKIPPING FOLDER: %s\n", (char *)q->str);
|
||||
if(data->quiet == 0) printf("SKIPPING FOLDER: %s\n", (char *)q->str);
|
||||
}
|
||||
else {
|
||||
if(quiet == 0) printf("processing folder: %s... ", (char *)q->str);
|
||||
if(data->quiet == 0) printf("processing folder: %s... ", (char *)q->str);
|
||||
|
||||
if(process_imap_folder(sd, &seq, q->str, sdata, data, use_ssl, dryrun, cfg) == ERR) ret = ERR;
|
||||
}
|
||||
@ -479,6 +478,7 @@ int main(int argc, char **argv){
|
||||
|
||||
data.folder = 0;
|
||||
data.recursive_folder_names = 0;
|
||||
data.quiet = 0;
|
||||
|
||||
import.import_job_id = import.total_messages = import.processed_messages = 0;
|
||||
import.started = import.updated = import.finished = 0;
|
||||
@ -597,7 +597,7 @@ int main(int argc, char **argv){
|
||||
break;
|
||||
|
||||
case 'q' :
|
||||
quiet = 1;
|
||||
data.quiet = 1;
|
||||
break;
|
||||
|
||||
case 'h' :
|
||||
@ -674,7 +674,7 @@ int main(int argc, char **argv){
|
||||
|
||||
close_database(&sdata);
|
||||
|
||||
if(quiet == 0) printf("\n");
|
||||
if(data.quiet == 0) printf("\n");
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user