diff -Naur maildrop-1.5.3/0README.txt maildrop-1.5.3.oden/0README.txt --- maildrop-1.5.3/0README.txt 1970-01-01 01:00:00.000000000 +0100 +++ maildrop-1.5.3.oden/0README.txt 2003-05-28 16:42:34.000000000 +0200 @@ -0,0 +1,15 @@ +Modified and original source files for Courier Maildrop 1.5.3. + +/maildir/maildircreate.c +/maildir/maildircreate.c-orig + +/maildrop/maildir.C +/maildrop/maildir.C-orig + + +Also, the resulting modified maildrop binary, compiled for +Intel 386 (Pentium Pro) on Red Hat 9.0. + +For full details see http://www.firstpr.com.au/web-mail/ + +- Robin Whittle 29 May 2003 \ No newline at end of file diff -Naur maildrop-1.5.3/maildir/maildircreate.c maildrop-1.5.3.oden/maildir/maildircreate.c --- maildrop-1.5.3/maildir/maildircreate.c 2003-01-26 05:07:03.000000000 +0100 +++ maildrop-1.5.3.oden/maildir/maildircreate.c 2003-05-28 16:33:35.000000000 +0200 @@ -3,6 +3,32 @@ ** See COPYING for distribution information. */ +/* +** Modified by Robin Whittle rw@firstpr.com.au +** 29 May 2003 to create the new file name with +** ":2,T" on the end to indicate that it is tagged +** for deletion at the next IMAP expunge operation +** - but only if the DELTAG variable is set to "1". +** +** See the other modified file: /maildrop/maildir.C +** for a full explanation. +** +** Mods are clearly commented and marked "RW". +** +** http://www.firstpr.com.au/web-mail/ +*/ + + /* RW + * + * A kludgey global variable to + * communicate the results of the + * test we do in maildir.C + * to here. + */ + +int deltagflag = 0; + + #include "maildircreate.h" #include "maildirmisc.h" #include <sys/types.h> @@ -87,7 +113,16 @@ const char *uniq=info->uniq; const char *hostname=info->hostname; - char hostname_buf[256]; + + /* RW + * + * Make this 4 longer because + * we may be making the file + * name 4 chars longer. + */ + + char hostname_buf[256 + 4]; + char time_buf[NUMBUFSIZE]; char usec_buf[NUMBUFSIZE]; char pid_buf[NUMBUFSIZE]; @@ -152,6 +187,31 @@ strcat(info->tmpname, hostname); strcat(info->tmpname, len_buf); + + /* RW + * + * I am not sure what this tmpname + * vs. newname stuff is, but we + * do the same mods here and + * below for newname. + * + * Check the value of deltagflag + * and if it is 1 then append: + * + * :2,T + * + * to the file name. + */ + + if (deltagflag == 1) + { + strcat(info->tmpname, ":2,T"); + } + + + + + if (stat( info->tmpname, &stat_buf) == 0) { maildir_tmpcreate_free(info); @@ -210,6 +270,37 @@ strcat(info->newname, hostname); strcat(info->newname, len_buf); + + + /* RW + * + * I am not sure what this tmpname + * vs. newname stuff is, but we + * do the same mods here and + * above for tmpname. + * + * Check the value of deltagflag + * and if it is 1 then append: + * + * :2,T + * + * to the file name. + * + * The code above allocates space for + * info->newname on the basis of the + * length of info->tmpname, which + * we already made potentially longer. + */ + + if (deltagflag == 1) + { + strcat(info->newname, ":2,T"); + } + + + + + return fd; } diff -Naur maildrop-1.5.3/maildrop/maildir.C maildrop-1.5.3.oden/maildrop/maildir.C --- maildrop-1.5.3/maildrop/maildir.C 2003-01-19 22:34:55.000000000 +0100 +++ maildrop-1.5.3.oden/maildrop/maildir.C 2003-05-28 16:33:40.000000000 +0200 @@ -3,6 +3,55 @@ ** See COPYING for distribution information. */ +/* +** Modified by Robin Whittle rw@firstpr.com.au +** 29 May 2003 to create the new file name with +** ":2,T" on the end to indicate that it is tagged +** for deletion at the next IMAP expunge operation +** - but only if the actions of .mailfilter, +** according to the nature of the message, have +** set the DELTAG variable is set to "1" +** +** The purpose of this is to allow the filter file +** to set this variable for SPAM, or for a message +** which has been copied to a mailing list mailbox +** and which we want to see it in the Inbox, but +** which we want tagged for deletion. This way +** we can see all activity on various mailing lists +** without having to look in their mailboxes, +** and can easily delete them all from our Inbox +** when we don't want to see them any more. +** +** This replicates the "Move to folder" function +** of Netscape's mail filtering system. +** +** +** Here, we test the DELTAG variable and set a +** global variable deltagflag accordingly. +** Then the standard code calls maildir_tmpcreate_fd() +** in /maildir/maildircreate.c . (Watch out for two +** functions of similar name, one ending in 'b' and +** the other in 'd'.) +** +** We test DELTAG here because code in this +** directory can use the varlist.c/h while I can't +** easily see a way of doing it in code in /maildir/ . +** +** It is in /maildir/maildircreate.c. that the +** additional ":2,T" characters may be added. +** +** We communicate whether DELTAG == 1 with a +** global variable kludgey global variable: +** "deltagflag". This is declared in +** /maildir/maildircreateh.c, as an int and +** initialised to 0. +*/ + + +extern int deltagflag; + + + #include "config.h" #include "maildir.h" #include "mio.h" @@ -118,6 +167,27 @@ abort_timer.Set( 24 * 60 * 60 ); while (!abort_timer.Expired()) { + + /* RW + * Set deltagflag according to + * the state of variable DELTAG. + */ +Buffer dtstring; + + dtstring = "DELTAG"; + + deltagflag = 0; + + if (strcmp (GetVarStr(dtstring), "1") == 0 ) + { + deltagflag = 1; + } + + + + + + Buffer name_buf; name_buf="UMASK";