]> Pileus Git - ~andy/fetchmail/commitdiff
Added -U option.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 13 Mar 1997 09:59:32 +0000 (09:59 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 13 Mar 1997 09:59:32 +0000 (09:59 -0000)
svn path=/trunk/; revision=931

NEWS
fetchmail.c
fetchmail.h
fetchmail.man
options.c
pop3.c
rcfile_l.l
rcfile_y.y
sample.rcfile

diff --git a/NEWS b/NEWS
index 2b69af43e92df296722e2d5a31a389094328100f..32d386480843477bd7086a8efca466ede74401eb 100644 (file)
--- 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.
 
 ------------------------------------------------------------------------------
index c01d255e2f01e745152434898e1c7298e1c36ed2..ce3015347be6916a79c663f85ba76cdfcdb5c790 100644 (file)
@@ -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)
index e2720cbc87df0eff190a46198269c563a08d3a70..526d7370f4a58b909547ad447c52b5017666f560 100644 (file)
@@ -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;
index cc2f72252e6f14e19e752922c072a2910ac51e51..653d3b12dca37d33ef766fe794f42a1910d22894 100644 (file)
@@ -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
index 1361868c1718989517d21049f0401fef81163432..10d93e361c9579b8cde0446735317e73500a2f30 100644 (file)
--- a/options.c
+++ b/options.c
 #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 bf91bc9206c7dcbb1867b89202f993e06847ef6f..4a232a1a07fd490191febbab2b5b39b860594bc7 100644 (file)
--- 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)
index 7c8591aa524c6656b7ce322623e1764a87dbc582..8d9ec034f0a55be7f69db9fbf23e86a94f9bf690 100644 (file)
@@ -62,6 +62,7 @@ fetchall      { return FETCHALL; }
 rewrite                { return REWRITE; }
 stripcr                { return STRIPCR; }
 dns            { return DNS; }
+uidl           { return UIDL; }
 
 limit          { return LIMIT; }
 
index 658c9c57cff018bb76dd7bc8cab89dc4a44359bf..20aea55db87bcf564d5c1eb9df2cbed1ae409598 100644 (file)
@@ -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;}
index dfc07b451b7221e9a88b03376297c26a1590f8be..75bc72cd30d1f48714fe14726de5d6705f4572c5 100644 (file)
@@ -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