aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--fetchmail.c3
-rw-r--r--fetchmail.h1
-rw-r--r--fetchmail.man6
-rw-r--r--options.c49
-rw-r--r--pop3.c7
-rw-r--r--rcfile_l.l1
-rw-r--r--rcfile_y.y4
-rw-r--r--sample.rcfile1
9 files changed, 50 insertions, 24 deletions
diff --git a/NEWS b/NEWS
index 2b69af43..32d38648 100644
--- a/NEWS
+++ b/NEWS
@@ -45,6 +45,8 @@ features --
* It is now possible to set a default poll interval with `set daemon'.
+* -U option to force UIDL use under POP3 (thanks, Ingmar Baumgart).
+
There are 249 people on the fetchmail-friends list.
------------------------------------------------------------------------------
diff --git a/fetchmail.c b/fetchmail.c
index c01d255e..ce301534 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -632,6 +632,7 @@ static int load_params(int argc, char **argv, int optind)
DEFAULT(ctl->rewrite, TRUE);
DEFAULT(ctl->stripcr, (ctl->mda != (char *)NULL));
DEFAULT(ctl->server.dns, TRUE);
+ DEFAULT(ctl->server.uidl, FALSE);
#undef DEFAULT
/* plug in the semi-standard way of indicating a mail address */
@@ -812,6 +813,8 @@ void dump_params (struct query *ctl)
printf(" (using port %d)", ctl->server.port);
else if (outlevel == O_VERBOSE)
printf(" (using default port)");
+ if (ctl->server.uidl)
+ printf(" (forcing UIDL use)");
putchar('.');
putchar('\n');
if (ctl->server.authenticate == A_KERBEROS)
diff --git a/fetchmail.h b/fetchmail.h
index e2720cbc..526d7370 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -75,6 +75,7 @@ struct hostdata /* shared among all user connections to given server */
char *envelope;
int skip;
int dns;
+ int uidl;
#ifdef linux
char *interface;
diff --git a/fetchmail.man b/fetchmail.man
index cc2f7225..653d3b12 100644
--- a/fetchmail.man
+++ b/fetchmail.man
@@ -153,6 +153,12 @@ higher) to immediately open an sender-SMTP connection to your your
client machine and begin forwarding any items addressed to your client
machine in the server's queue of undelivered mail.
.TP
+.B \-U, --uidl
+Force UIDL use (effective only with POP3). Force client-side tracking
+of `newness' of messages. Use with `keep' to use a mailbox as a baby
+news drop for a group of users; if the mailbox is periodically purged,
+every member will get a chance to read the message.
+.TP
.B \-P, --port
The option permits you to specify a TCP/IP port to connect on.
This option will seldom be necessary as all the supported protocols have
diff --git a/options.c b/options.c
index 1361868c..10d93e36 100644
--- a/options.c
+++ b/options.c
@@ -29,27 +29,28 @@
#define LA_RCFILE 11
#define LA_IDFILE 12
#define LA_PROTOCOL 13
-#define LA_PORT 14
-#define LA_AUTHENTICATE 15
-#define LA_TIMEOUT 16
-#define LA_ENVELOPE 17
-#define LA_USERNAME 18
-#define LA_ALL 19
-#define LA_KILL 20
-#define LA_KEEP 21
-#define LA_FLUSH 22
-#define LA_NOREWRITE 23
-#define LA_LIMIT 24
-#define LA_REMOTEFILE 25
-#define LA_SMTPHOST 26
-#define LA_BATCHLIMIT 27
-#define LA_FETCHLIMIT 28
-#define LA_MDA 29
-#define LA_INTERFACE 30
-#define LA_MONITOR 31
-#define LA_YYDEBUG 32
-
-static char *shortoptions = "?Vcsvd:NqL:f:i:p:P:A:t:E:u:akKFnl:r:S:b:B:m:I:M:y";
+#define LA_UIDL 14
+#define LA_PORT 15
+#define LA_AUTHENTICATE 16
+#define LA_TIMEOUT 17
+#define LA_ENVELOPE 18
+#define LA_USERNAME 19
+#define LA_ALL 20
+#define LA_KILL 21
+#define LA_KEEP 22
+#define LA_FLUSH 23
+#define LA_NOREWRITE 24
+#define LA_LIMIT 25
+#define LA_REMOTEFILE 26
+#define LA_SMTPHOST 27
+#define LA_BATCHLIMIT 28
+#define LA_FETCHLIMIT 29
+#define LA_MDA 30
+#define LA_INTERFACE 31
+#define LA_MONITOR 32
+#define LA_YYDEBUG 33
+
+static char *shortoptions = "?Vcsvd:NqL:f:i:p:UP:A:t:E:u:akKFnl:r:S:b:B:m:I:M:y";
static struct option longoptions[] = {
{"help", no_argument, (int *) 0, LA_HELP },
{"version", no_argument, (int *) 0, LA_VERSION },
@@ -66,6 +67,7 @@ static struct option longoptions[] = {
{"protocol", required_argument, (int *) 0, LA_PROTOCOL },
{"proto", required_argument, (int *) 0, LA_PROTOCOL },
+ {"uidl", no_argument, (int *) 0, LA_UIDL },
{"port", required_argument, (int *) 0, LA_PORT },
{"auth", required_argument, (int *) 0, LA_AUTHENTICATE},
{"timeout", required_argument, (int *) 0, LA_TIMEOUT },
@@ -193,6 +195,10 @@ struct query *ctl; /* option record to be initialized */
errflag++;
}
break;
+ case 'U':
+ case LA_UIDL:
+ ctl->server.uidl = FLAG_TRUE;
+ break;
case 'P':
case LA_PORT:
ctl->server.port = atoi(optarg);
@@ -330,6 +336,7 @@ struct query *ctl; /* option record to be initialized */
#endif
fputs(" -p, --protocol specify pop2, pop3, imap, apop, rpop, kpop, etrn\n", stderr);
+ fputs(" -U, --uidl force the use of UIDLs (pop3 only)\n", stderr);
fputs(" -P, --port TCP/IP service port to connect to\n",stderr);
fputs(" -A, --auth authentication type (password or kerberos)\n",stderr);
fputs(" -t, --timeout server nonresponse timeout\n",stderr);
diff --git a/pop3.c b/pop3.c
index bf91bc92..4a232a1a 100644
--- a/pop3.c
+++ b/pop3.c
@@ -153,8 +153,11 @@ static int pop3_getrange(FILE *sockfp, struct query *ctl, int*countp, int*newp)
{
char id [IDLEN+1];
- gen_send(sockfp,"LAST");
- ok = pop3_ok(sockfp, buf);
+ if (!ctl->server.uidl) {
+ gen_send(sockfp,"LAST");
+ ok = pop3_ok(sockfp, buf);
+ } else
+ ok = 1;
if (ok == 0)
{
if (sscanf(buf, "%d", &last) == 0)
diff --git a/rcfile_l.l b/rcfile_l.l
index 7c8591aa..8d9ec034 100644
--- a/rcfile_l.l
+++ b/rcfile_l.l
@@ -62,6 +62,7 @@ fetchall { return FETCHALL; }
rewrite { return REWRITE; }
stripcr { return STRIPCR; }
dns { return DNS; }
+uidl { return UIDL; }
limit { return LIMIT; }
diff --git a/rcfile_y.y b/rcfile_y.y
index 658c9c57..20aea55d 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -48,7 +48,7 @@ static void user_reset();
%token <proto> PROTO
%token <sval> STRING
%token <number> NUMBER
-%token NO KEEP FLUSH FETCHALL REWRITE STRIPCR DNS PORT
+%token NO KEEP FLUSH FETCHALL REWRITE STRIPCR DNS PORT UIDL
%%
@@ -198,12 +198,14 @@ user_option : TO localnames HERE
| FETCHALL {current.fetchall = FLAG_TRUE;}
| REWRITE {current.rewrite = FLAG_TRUE;}
| STRIPCR {current.stripcr = FLAG_TRUE;}
+ | UIDL {current.uidl = FLAG_TRUE;}
| NO KEEP {current.keep = FLAG_FALSE;}
| NO FLUSH {current.flush = FLAG_FALSE;}
| NO FETCHALL {current.fetchall = FLAG_FALSE;}
| NO REWRITE {current.rewrite = FLAG_FALSE;}
| NO STRIPCR {current.stripcr = FLAG_FALSE;}
+ | NO UIDL {current.uidl = FLAG_FALSE;}
| LIMIT NUMBER {current.limit = $2;}
| FETCHLIMIT NUMBER {current.fetchlimit = $2;}
diff --git a/sample.rcfile b/sample.rcfile
index dfc07b45..75bc72cd 100644
--- a/sample.rcfile
+++ b/sample.rcfile
@@ -22,6 +22,7 @@
# poll -- must be followed by a mailserver name
# skip -- must be followed by a mailserver name
# protocol (or proto) -- must be followed by a protocol ID
+# uidl
# port -- must be followed by a TCP/IP port number
# authenticate (or auth) -- must be followed by an authentication type
# timeout -- must be followed by a numeric timeout value