]> Pileus Git - ~andy/fetchmail/commitdiff
Added the dropstatus option.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 28 Jul 1997 16:16:13 +0000 (16:16 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 28 Jul 1997 16:16:13 +0000 (16:16 -0000)
svn path=/trunk/; revision=1183

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

diff --git a/NEWS b/NEWS
index 059211ddf0d0ea429fc7e3c676ce5f39169e07fb..3423705fd7a8665c1d2233485c4ee2b53871a70f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,7 @@
 fetchmail 4.0.3 ()
 * Replace vsprintf with vnsprintf to avoid buffer-overrun screws.
 * Added via option to make ssh configuration cleaner.
+* Added dropstatus option to cope with xbuffy.
 * Allow either `login' or `user' in .netrc files.
 
 There are 257 people on the fetchmail-friends list.
index 934ddacb078b6035e216d2dc25fbe64b40e0c3ef..44e2e3098e5b5be982d9694e74425ce71817090b 100644 (file)
--- a/driver.c
+++ b/driver.c
@@ -597,6 +597,34 @@ char *realname;            /* real name of host */
            continue;
        }
 
+       /*
+        * If we see a Status line, it may have been inserted by an MUA
+        * on the mail host, or it may have been inserted by the server
+        * program after the headers in the transaction stream.  This
+        * can actually hose some new-mail notifiers such as xbuffy,
+        * which assumes any Status line came from a *local* MDA and
+        * therefore indicates that the message has been seen.
+        *
+        * Some buggy POP servers (including at least the 3.3(20)
+        * version of the one distributed with IMAP) insert empty
+        * Status lines in the transaction stream; we'll chuck those
+        * unconditionally.  Nonempty ones get chucked if the user
+        * turns on the dropstatus flag.
+        */
+       if (!strncasecmp(line, "Status:", 7))
+       {
+           char        *cp;
+
+           for (cp = line + 7; *cp && isspace(*cp); cp++)
+               continue;
+
+           if (!*cp || ctl->dropstatus)
+           {
+               free(line);
+               continue;
+           }
+       }
+
        /*
         * OK, this is messy.  If we're forwarding by SMTP, it's the
         * SMTP-receiver's job (according to RFC821, page 22, section
index dfd0c30098f1c800e458986b9570fd97d2bb8f04..68e8e4dc826cbe11b64b8d489887fec722d8c02e 100644 (file)
@@ -602,6 +602,7 @@ static int load_params(int argc, char **argv, int optind)
            DEFAULT(ctl->stripcr, (ctl->mda != (char *)NULL)); 
            DEFAULT(ctl->forcecr, FALSE);
            DEFAULT(ctl->pass8bits, FALSE);
+           DEFAULT(ctl->dropstatus, FALSE);
            DEFAULT(ctl->server.dns, TRUE);
            DEFAULT(ctl->server.uidl, FALSE);
 #undef DEFAULT
@@ -878,6 +879,9 @@ void dump_params (struct query *ctl)
     printf("  Interpretation of Content-Transfer-Encoding is %sabled (pass8bits %s).\n",
           ctl->pass8bits ? "dis" : "en",
           ctl->pass8bits ? "on" : "off");
+    printf("  Nonempty Status lines will be %s (dropstatus %s)\n",
+          ctl->dropstatus ? "discarded" : "kept",
+          ctl->dropstatus ? "on" : "off");
     if (ctl->limit > 0)
        printf("  Message size limit is %d bytes (--limit %d).\n", 
               ctl->limit, ctl->limit);
index 24ef5ee0bea48f1873b1eb3bcc01199783a6c868..aa3d6474a1d64c8ba43680ca2e0953ef840ddffd 100644 (file)
@@ -131,6 +131,7 @@ struct query
     flag stripcr;              /* if TRUE, strip CRs in text */
     flag forcecr;              /* if TRUE, force CRs before LFs in text */
     flag pass8bits;            /* if TRUE, ignore Content-Transfer-Encoding */
+    flag dropstatus;           /* if TRUE, drop Status lines in mail */
     int        limit;                  /* limit size of retrieved messages */
     int        fetchlimit;             /* max # msgs to get in single poll */
     int        batchlimit;             /* max # msgs to pass in single SMTP session */
index 792093fb93699c74e495f1fab0bee1978dfb94f0..1311cfe6b364ea561c37008e1c273ab3aa958d6d 100644 (file)
@@ -686,6 +686,7 @@ Legal user options are
     stripcr
     forcecr
     pass8bits
+    dropstatus
     dns
     no keep
     no flush
@@ -694,6 +695,7 @@ Legal user options are
     no stripcr
     no forcecr
     no pass8bits
+    no dropstatus
     no dns
     no envelope
     limit
@@ -706,9 +708,9 @@ comma-separated list of names following them.
 .PP
 All options correspond to the obvious command-line arguments, except
 the following: `via', `interval', `aka', `is', `to', `dns'/`no dns',
-\&`password', \&`preconnect', `localdomains', `stripcr'/`no stripcr' ,
-\&`forcecr'/`no forcecr', `pass8bits'/`no pass8bits' and `no
-received'.
+\&`password', \&`preconnect', `localdomains', `stripcr'/`no stripcr',
+\&`forcecr'/`no forcecr', `pass8bits'/`no pass8bits' `dropstatus/no
+dropstatus', and `no received'.
 .PP
 The `via' option is for use with ssh, or if you want to have more
 than one configuration pointing at the same site.  If it is present,
@@ -819,6 +821,14 @@ is forced to declare BODY=8BITMIME to any ESMTP-capable listener.  If
 the listener is 8-bit-clean (as all the major ones now are) the right
 thing will probably result.
 .PP
+The `dropstatus' option controls whether nonempty Status lines are
+retained in fetched mail (the default) or discarded.  Retaining them
+allows your MUA to see what messages (if any) were marked seen on the
+client.  On the other hand, it can confuse some new-mail notifiers,
+which assume that anything with a Status line in it has been seen.
+(Note: the empty Status lines inserted by some buggy POP servers are
+unconditionally discarded.)
+.PP
 Legal protocol identifiers are
 
     auto (or AUTO)
index fdb6e03d986851aa76e410bbcc9cc01ffd05c2aa..64e260172304687b0fed73a9f3e124d34ff280c6 100644 (file)
@@ -67,6 +67,7 @@ rewrite               { return REWRITE; }
 forcecr                { return FORCECR; }
 stripcr                { return STRIPCR; }
 pass8(bits)?   { return PASS8BITS; }
+dropstatus?    { return DROPSTATUS; }
 dns            { return DNS; }
 uidl           { return UIDL; }
 
index d970594534b0f5c6c95501b7895b3640156949c8..55b5f7b3b706aca5b0cee41218c6f6aa1e63464b 100644 (file)
@@ -62,7 +62,7 @@ extern char * yytext;
 %token <proto> PROTO
 %token <sval>  STRING
 %token <number> NUMBER
-%token NO KEEP FLUSH FETCHALL REWRITE FORCECR STRIPCR PASS8BITS 
+%token NO KEEP FLUSH FETCHALL REWRITE FORCECR STRIPCR PASS8BITS DROPSTATUS
 %token DNS PORT UIDL INTERVAL
 
 %%
@@ -227,6 +227,7 @@ user_option : TO localnames HERE
                | FORCECR               {current.forcecr    = FLAG_TRUE;}
                | STRIPCR               {current.stripcr    = FLAG_TRUE;}
                | PASS8BITS             {current.pass8bits  = FLAG_TRUE;}
+               | DROPSTATUS            {current.dropstatus = FLAG_TRUE;}
 
                | NO KEEP               {current.keep       = FLAG_FALSE;}
                | NO FLUSH              {current.flush      = FLAG_FALSE;}
@@ -234,6 +235,8 @@ user_option : TO localnames HERE
                | NO REWRITE            {current.rewrite    = FLAG_FALSE;}
                | NO FORCECR            {current.forcecr    = FLAG_FALSE;}
                | NO STRIPCR            {current.stripcr    = FLAG_FALSE;}
+               | NO PASS8BITS          {current.pass8bits  = FLAG_FALSE;}
+               | NO DROPSTATUS         {current.dropstatus = FLAG_FALSE;}
 
                | LIMIT NUMBER          {current.limit      = $2;}
                | FETCHLIMIT NUMBER     {current.fetchlimit = $2;}
index fd648fc64d945f7e408e768ac337cf496d383a80..aa1a31b8b72e61b331a37d9339bc44bf69ef3066 100644 (file)
@@ -49,6 +49,7 @@
 #   forcecr
 #   stripcr
 #   pass8bits
+#   dropstatus
 #   dns
 #   no keep
 #   no flush
@@ -58,6 +59,8 @@
 #   no stripcr
 #   no dns
 #   no envelope
+#   no pass8bits
+#   no dropstatus
 #   limit                     -- must be followed by numeric size limit
 #   fetchlimit                -- must be followed by numeric msg fetch limit
 #   batchlimit                -- must be followed by numeric SMTP batch limit