]> Pileus Git - ~andy/fetchmail/commitdiff
Duplicate suppression.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 14 Sep 1999 06:35:11 +0000 (06:35 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 14 Sep 1999 06:35:11 +0000 (06:35 -0000)
svn path=/trunk/; revision=2553

NEWS
driver.c
fetchmail.h
fetchmail.man

diff --git a/NEWS b/NEWS
index b2fa06de0e74234cefe809d66f4d10ce9c49184e..ef7f70af821a68ab63348307b492aaa086b61b0c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@
 fetchmail-5.0.8 ():
 * Todd Sabin's patch to accept spaces in CRAM-MD5 names.
 * Fix to endianness patch, by Dan Root via Lawrence Rogers.
+* Suppress duplicates by message ID in multidrop mode.
 
 fetchmail-5.0.7 (Sat Aug 21 04:26:13 EDT 1999):
 * RPA support works again.
index 444eda0e947302885c1f8093e4925f443479b6fa..42bfacfc9bb2ae505edf214f59888f8eed4ea0d7 100644 (file)
--- a/driver.c
+++ b/driver.c
@@ -527,6 +527,29 @@ static int readheaders(int sock,
        /* we see an ordinary (non-header, non-message-delimiter line */
        has_nuls = (linelen != strlen(line));
 
+       /*
+        * When mail delivered to a multidrop mailbox on the server is
+        * addressed to multiple people, there will be one copy left
+        * in the box for each recipient.  Thus, if the mail is addressed
+        * to N people, each recipient would get N copies.
+        *
+        * Foil this by suppressing all but one copy of a message with
+        * a given Message-ID.  Note: This implementation only catches
+        * runs of successive identical messages, but that should be
+        * good enough.
+        */
+       if (MULTIDROP(ctl) && !strncasecmp(line, "Message-ID:", 11))
+       {
+           if (ctl->lastid && !strcasecmp(ctl->lastid, line))
+               return(PS_REFUSED);
+           else
+           {
+               if (ctl->lastid)
+                   free(ctl->lastid);
+               ctl->lastid = strdup(line);
+           }
+       }
+
        /*
         * The University of Washington IMAP server (the reference
         * implementation of IMAP4 written by Mark Crispin) relies
index 9ff6d89933b11dcff8feef21a4b486942830f4eb..c2b8b17ed8fbd72a94649bf087dce3634b324925 100644 (file)
@@ -266,6 +266,7 @@ struct query
     unsigned int uid;          /* UID of user to deliver to */
     struct idlist *skipped;    /* messages skipped on the mail server */
     struct idlist *oldsaved, *newsaved;
+    char *lastid;              /* last Message-ID seen on this connection */
 
     /* internal use -- per-message state */
     int mimemsg;               /* bitmask indicating MIME body-type */
index abf9c2d1cc7b7957a0f07dd906d47f402b35683b..2c2ac746985f99eda27e69fd62b25788cfc5523f 100644 (file)
@@ -870,8 +870,9 @@ code recognizes and discards the message on any of a list of responses
 that defaults to [571, 550, 501, 554] but can be set with the `antispam'
 option.  This is one of the
 .I only
-two circumstance under which fetchmail ever discards mail (the others
-are the 552 and 553 errors described below).
+three circumstance under which fetchmail ever discards mail (the others
+are the 552 and 553 errors described below, and the suppression of
+multidropped messages with a message-ID already seen).
 .PP
 If
 .I fetchmail
@@ -1543,6 +1544,12 @@ poll mailhost.net via localhost port 1234 with proto pop3:
 Use the multiple-local-recipients feature with caution -- it can bite.
 Also note that all multidrop features are ineffective in ETRN mode.
 
+Also, note that in multidrop mode duplicate mails are suppressed.
+A piece of mail is considered duplicate if it has the same message-ID 
+as the message immediately preceding.  Such runs of messages may
+be generated when copies of a message addressed to multiple 
+users are delivered to a multidrop box.
+
 .SS Header vs. Envelope addresses 
 The fundamental problem is that by having your mailserver toss several
 peoples' mail in a single maildrop box, you may have thrown away