From: <tom...@us...> - 2003-10-13 23:14:43
|
Update of /cvsroot/qmailadmin/qmailadmin In directory sc8-pr-cvs1:/tmp/cvs-serv2507 Modified Files: mailinglist.c Log Message: add 'Reply-To' to headerremove when setting Reply-To in headeradd. [fixes bug 810670] Index: mailinglist.c =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/mailinglist.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- mailinglist.c 10 Oct 2003 16:36:24 -0000 1.3 +++ mailinglist.c 13 Oct 2003 23:14:39 -0000 1.4 @@ -353,44 +353,35 @@ } -/* sets the Reply-To header in headeradd file based on form fields +/* sets the Reply-To header in header* files based on form fields * designed to be called by ezmlm_make() (after calling ezmlm-make) + * Replaces the "Reply-To" line in <filename> with <newtext>. */ -void ezmlm_setreplyto () +void ezmlm_setreplyto (char *filename, char *newtext) { - FILE *headeradd, *temp; + FILE *headerfile, *temp; char realfn[256]; char tempfn[256]; char buf[256]; - sprintf (realfn, "%s/%s/headeradd", RealDir, ActionUser); + sprintf (realfn, "%s/%s/%s", RealDir, ActionUser, filename); sprintf (tempfn, "%s.tmp", realfn); - headeradd = fopen(realfn, "r"); - if (!headeradd) return; + headerfile = fopen(realfn, "r"); + if (!headerfile) return; temp = fopen(tempfn, "w"); - if (!temp) { fclose (headeradd); return; } + if (!temp) { fclose (headerfile); return; } /* copy contents to new file, except for Reply-To header */ - while (fgets (buf, sizeof(buf), headeradd) != NULL) { - if (strncasecmp ("Reply-To: ", buf, 10) != 0) { + while (fgets (buf, sizeof(buf), headerfile) != NULL) { + if (strncasecmp ("Reply-To", buf, 8) != 0) { fputs (buf, temp); } } - /* add Reply-To header if not set to SENDER */ - GetValue (TmpCGI, buf, "replyto=", sizeof(buf)); - replyto = atoi(buf); - if (replyto == REPLYTO_LIST) { - strcpy (buf, "Reply-To: <#l#>@<#h#>\n"); - fputs (buf, temp); - } else if (replyto == REPLYTO_ADDRESS) { - GetValue (TmpCGI, replyto_addr, "replyaddr=", sizeof(replyto_addr)); - sprintf (buf, "Reply-To: %s\n", replyto_addr); - fputs (buf, temp); - } + fputs (newtext, temp); - fclose (headeradd); + fclose (headerfile); fclose (temp); unlink (realfn); rename (tempfn, realfn); @@ -572,7 +563,22 @@ } /* set Reply-To header */ - ezmlm_setreplyto(); + GetValue (TmpCGI, TmpBuf, "replyto=", sizeof(TmpBuf)); + replyto = atoi(TmpBuf); + if (replyto == REPLYTO_SENDER) { + /* ezmlm shouldn't remove/add Reply-To header */ + ezmlm_setreplyto ("headeradd", ""); + ezmlm_setreplyto ("headerremove", ""); + } else { + if (replyto == REPLYTO_ADDRESS) { + GetValue (TmpCGI, replyto_addr, "replyaddr=", sizeof(replyto_addr)); + sprintf (TmpBuf, "Reply-To: %s\n", replyto_addr); + } else { /* REPLYTO_LIST */ + strcpy (TmpBuf, "Reply-To: <#l#>@<#h#>\n"); + } + ezmlm_setreplyto ("headeradd", TmpBuf); + ezmlm_setreplyto ("headerremove", "Reply-To"); + } /* update inlocal file */ sprintf(TmpBuf, "%s/%s/inlocal", RealDir, ActionUser); |