diff options
Diffstat (limited to 'fetchmail.c')
-rw-r--r-- | fetchmail.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/fetchmail.c b/fetchmail.c index 7d9073c8..d65de5f4 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -58,6 +58,7 @@ int check_only; /* if --probe was set */ /* miscellaneous global controls */ char *rcfile; /* path name of rc file */ +char *idfile; /* UID list file */ int versioninfo; /* emit only version info */ /********************************************************************* @@ -130,6 +131,12 @@ char **argv; strcat(rcfile, "/"); strcat(rcfile, tmpdir); +#define IDFILE_NAME ".fetchids" + idfile = (char *) xmalloc(strlen(home)+strlen(IDFILE_NAME)+2); + strcpy(idfile, home); + strcat(idfile, "/"); + strcat(idfile, IDFILE_NAME); + outlevel = O_NORMAL; if ((parsestatus = parsecmdline(argc,argv,&cmd_opts)) < 0) @@ -233,6 +240,12 @@ char **argv; strcat(tmpbuf, "/fetchmail-"); strcat(tmpbuf, user); + /* initialize UID handling */ + if ((st = prc_filecheck(idfile)) != 0) + exit(st); + else + initialize_saved_lists(hostlist, idfile); + /* perhaps we just want to check options? */ if (versioninfo) { printf("Taking options from command line"); @@ -351,7 +364,10 @@ char **argv; do { for (hostp = hostlist; hostp; hostp = hostp->next) { if (hostp->active && !(implicitmode && hostp->skip)) + { popstatus = query_host(hostp); + update_uid_lists(hostp); + } } sleep(poll_interval); @@ -371,6 +387,8 @@ void termhook(int sig) if (sig != 0) fprintf(stderr, "terminated with signal %d\n", sig); + write_saved_lists(hostlist, idfile); + unlink(lockfile); exit(popstatus); } @@ -520,6 +538,22 @@ struct hostrec *queryctl; } else printf(" Messages will be SMTP-forwarded to '%s'\n", queryctl->smtphost); + if (queryctl->protocol > P_POP2) + if (!queryctl->saved) + printf(" No UIDs saved from this host.\n"); + else + { + struct idlist *idp; + int count = 0; + + for (idp = hostp->saved; idp; idp = idp->next) + ++count; + + printf(" %d UIDs saved.\n", count); + if (outlevel == O_VERBOSE) + for (idp = hostp->saved; idp; idp = idp->next) + fprintf(stderr, "\t%s %s\n", hostp->servername, idp->id); + } } /********************************************************************* |