aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--fetchmail.c15
-rw-r--r--fetchmail.h2
-rw-r--r--fetchmail.man7
-rw-r--r--rcfile_l.l1
-rw-r--r--rcfile_y.y5
-rw-r--r--sample.rcfile1
7 files changed, 30 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index f740ea05..1320a888 100644
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,7 @@ pl 3.9.6 ():
* Support for Kerberos-v4-authenticated IMAP.
* Don't choke on RFC822 group names.
* More improvements in RFC822 name parsing.
+* Interval skip feature, courtesy of Hal DeVore.
pl 3.9.5 (Sun May 18 01:05:13 EDT 1997):
* Add an error notification when an incoming message has embedded NULs.
diff --git a/fetchmail.c b/fetchmail.c
index 9652dab3..8438c42e 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -750,6 +750,18 @@ static int query_host(struct query *ctl)
{
int i, st;
+ if (poll_interval && ctl->server.interval)
+ {
+ if (ctl->server.poll_count++ % ctl->server.interval)
+ {
+ if (outlevel == O_VERBOSE)
+ fprintf(stderr,
+ "fetchmail: interval not reached, not querying %s\n",
+ ctl->server.names->id);
+ return PS_NOMAIL;
+ }
+ }
+
if (outlevel == O_VERBOSE)
{
time_t now;
@@ -800,6 +812,9 @@ void dump_params (struct query *ctl)
printf(" Logfile is %s\n", logfile);
if (poll_interval)
printf(" Poll interval is %d seconds\n", poll_interval);
+ if (ctl->server.interval)
+ printf(" Poll of this server will occur every %d intervals.\n",
+ ctl->server.interval);
#ifdef HAVE_GETHOSTBYNAME
if (ctl->server.canonical_name)
printf(" Canonical DNS name of server is %s.\n", ctl->server.canonical_name);
diff --git a/fetchmail.h b/fetchmail.h
index 53f4ffa8..689a5843 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -72,6 +72,7 @@ struct hostdata /* shared among all user connections to given server */
struct idlist *localdomains; /* list of pass-through domains */
int protocol;
int port;
+ int interval;
int authenticate;
int timeout;
char *envelope;
@@ -87,6 +88,7 @@ struct hostdata /* shared among all user connections to given server */
#endif /* linux */
/* computed for internal use */
+ int poll_count; /* count of polls so far */
#ifdef HAVE_GETHOSTBYNAME
char *canonical_name; /* DNS canonical name of server host */
#endif /* HAVE_GETHOSTBYNAME */
diff --git a/fetchmail.man b/fetchmail.man
index 455f2c43..85827261 100644
--- a/fetchmail.man
+++ b/fetchmail.man
@@ -653,10 +653,15 @@ The 'remotefolder' and 'smtphost' options can take a space- or
comma-separated list of names following them.
.PP
All options correspond to the obvious command-line arguments, except
-the following: `aka', `is', `to', `dns'/`no dns', `password',
+the following: `interval', `aka', `is', `to', `dns'/`no dns', `password',
\&`preconnect', `localdomains', `stripcr'/`no stripcr' ,
\&`forcecr'/`no forcecr' and `no received'.
.PP
+The `interval' option (which takes a numeric argument) allows you to poll a
+server less frequently than the basic poll interval. If you say
+\&`interval N' the server this option is attached to will only be
+queried every N poll intervals.
+.PP
The `is' or `to' keywords associate the following local (client)
name(s) (or server-name to client-name mappings separated by =) with
the mailserver user name in the entry. If an is/to list has `*' as
diff --git a/rcfile_l.l b/rcfile_l.l
index d52d6389..cfb71a0b 100644
--- a/rcfile_l.l
+++ b/rcfile_l.l
@@ -33,6 +33,7 @@ aka { return AKA; }
local(domains) { return LOCALDOMAINS; }
proto(col)? { return PROTOCOL; }
port { return PORT; }
+interval { return INTERVAL; }
auth(enticate)? { return AUTHENTICATE; }
kerberos_v4 { return KERBEROS4; }
kerberos { return KERBEROS4; }
diff --git a/rcfile_y.y b/rcfile_y.y
index c2f121a5..89251766 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -49,7 +49,7 @@ static int reset_server(char *name, int skip);
%token <proto> PROTO
%token <sval> STRING
%token <number> NUMBER
-%token NO KEEP FLUSH FETCHALL REWRITE FORCECR STRIPCR DNS PORT UIDL
+%token NO KEEP FLUSH FETCHALL REWRITE FORCECR STRIPCR DNS PORT UIDL INTERVAL
%%
@@ -121,6 +121,7 @@ serv_option : AKA alias_list
| UIDL {current.server.uidl = FLAG_TRUE;}
| NO UIDL {current.server.uidl = FLAG_FALSE;}
| PORT NUMBER {current.server.port = $2;}
+ | INTERVAL NUMBER {current.server.interval = $2;}
| AUTHENTICATE PASSWORD {current.server.authenticate = A_PASSWORD;}
| AUTHENTICATE KERBEROS4 {current.server.authenticate = A_KERBEROS_V4;}
| TIMEOUT NUMBER {current.server.timeout = $2;}
@@ -387,6 +388,7 @@ static void record_current(void)
#define FLAG_FORCE(fld) if (cmd_opts.fld) current.fld = cmd_opts.fld
FLAG_FORCE(server.protocol);
FLAG_FORCE(server.port);
+ FLAG_FORCE(server.interval);
FLAG_FORCE(server.authenticate);
FLAG_FORCE(server.timeout);
FLAG_FORCE(server.envelope);
@@ -434,6 +436,7 @@ void optmerge(struct query *h2, struct query *h1)
#define FLAG_MERGE(fld) if (!h2->fld) h2->fld = h1->fld
FLAG_MERGE(server.protocol);
FLAG_MERGE(server.port);
+ FLAG_MERGE(server.interval);
FLAG_MERGE(server.authenticate);
FLAG_MERGE(server.timeout);
FLAG_MERGE(server.envelope);
diff --git a/sample.rcfile b/sample.rcfile
index e0edc8d7..5023f60c 100644
--- a/sample.rcfile
+++ b/sample.rcfile
@@ -21,6 +21,7 @@
# Legal keywords are
# poll -- must be followed by a mailserver name
# skip -- must be followed by a mailserver name
+# interval -- must be followed by an interval skip count
# protocol (or proto) -- must be followed by a protocol ID
# uidl
# port -- must be followed by a TCP/IP port number