More polishing...

Below is a set of patches to take care of a few bugs. My earlier patch to get rid of extra Re:'s is included in a modified form.
Changes:
- No double Reply-To:'s to list mail. Reply-To:'s in some admin mail still remain.
- Get rid of extra Re:'s on the subject line. However, leave "Re: PREFIX" instead of "PREFIX Re:" - the latter does not work with some mail readers which use Re: for threading (and there was some strange problems with answering the mail as well).
- Some people wanted to have Reply-To: in every attachment of a MIME digest (for lists with reply_to_list true).
- A bug in digest topic section (wrong argument order to ""%(...)) corrected. Some polishing of the header (to make it more useful to the most helpless non-WWW-subscribers).
- crontab: the right name of the script is senddigests.
*** modules/mm_deliver.dist.py Wed Apr 15 20:43:04 1998 --- modules/mm_deliver.py Thu Apr 16 22:16:38 1998
*** 123,128 **** --- 123,131 ---- else: tempfile.template = tmpfile_prefix + 'mailman.' if self.reply_goes_to_list:
# Get rid of old Reply-To:
for item in msg.headers:
msg.headers.append('Errors-To: %s\n' % self.GetAdminEmail())if item[0:9] == 'Reply-To:': msg.headers.remove(item) msg.headers.append('Reply-To: %s\n' % self.GetListEmail())
*** modules/maillist.dist.py Sun Apr 12 07:34:01 1998 --- modules/maillist.py Thu Apr 16 21:07:18 1998
*** 747,755 **** prefix = self.subject_prefix if not subj: msg.SetHeader('Subject', '%s(no subject)' % prefix) ! elif not re.match("(re:? *)?" + re.escape(self.subject_prefix), ! subj, re.I): ! msg.SetHeader('Subject', '%s%s' % (prefix, subj))
if self.digestable:
self.SaveForDigest(msg)
--- 747,763 ---- prefix = self.subject_prefix if not subj: msg.SetHeader('Subject', '%s(no subject)' % prefix) ! else: ! if re.match("(re:? *)*" + re.escape(prefix), subj, re.I): ! # The subject prefix is there already, possibly with some Re:'s. ! # Take the extra Re:'s away, put one behind prefix. ! prefix_mess_rx=re.compile('^(re:? *)*' + ! re.escape(prefix) + '(re:? *)*', re.I) ! subj=re.sub(prefix_mess_rx, 'Re: ' + prefix, subj) ! else: ! # No prefix yet. ! subj=prefix+subj ! msg.SetHeader('Subject', subj)
if self.digestable:
self.SaveForDigest(msg)
*** modules/mm_digest.dist.py Thu Apr 16 20:57:13 1998 --- modules/mm_digest.py Thu Apr 16 22:03:10 1998
*** 97,106 **** body = self.QuoteMime(post.body) topics_file.write(" %d. %s (%s)\n" % (self.next_post_number, subject, sender)) digest_file.write("--%s\n\nMessage: %d" ! "\nFrom: %s\nDate: %s\nSubject: %s\n\n%s" % (self._mime_separator, self.next_post_number, ! fromline, date, subject, body)) self.next_post_number = self.next_post_number + 1 topics_file.close() --- 97,116 ---- body = self.QuoteMime(post.body) topics_file.write(" %d. %s (%s)\n" % (self.next_post_number, subject, sender))
- try:
if self.reply_goes_to_list:
maybe_replyto='Reply-To: %s\n' % (
self.QuoteMime(self.GetListEmail()),)
else:
maybe_replyto=''
except:
self.LogMsg("error",
"mm_digest: tried to include reply-to - not quite")
- digest_file.write("--%s\n\nMessage: %d" ! "\nFrom: %s\nDate: %s\nSubject: %s\n%s\n%s" % (self._mime_separator, self.next_post_number, ! fromline, date, subject, maybe_replyto, body)) self.next_post_number = self.next_post_number + 1 topics_file.close()
*** 185,198 **** Subject: Contents of %s digest, Volume %d #%d Date: %s
! When replying, please edit your Subject line so it is more specific than "Re: Contents of %s digest..."
Send %s maillist submissions to %s To subscribe or unsubscribe via the web, visit %s ! or send email to %s
Topics for this digest: %s --- 195,210 ---- Subject: Contents of %s digest, Volume %d #%d Date: %s
! When replying, please edit your Subject line to be more specific than just "Re: Contents of %s digest..."
Send %s maillist submissions to %s To subscribe or unsubscribe via the web, visit %s ! or send email to ! %s ! A message saying just 'help' (without the quotes) will give you a guide.
Topics for this digest: %s
*** 200,207 ****
msg.GetSender(),
self.real_name, self.volume, self.next_digest_number,
time.ctime(time.time()),
! self.real_name, self.GetListEmail(),
! self.real_name,
self.GetScriptURL('listinfo'),
self.GetRequestEmail(),
topics_text)
--- 212,219 ----
msg.GetSender(),
self.real_name, self.volume, self.next_digest_number,
time.ctime(time.time()),
! self.real_name, self.real_name,
! self.GetListEmail(),
self.GetScriptURL('listinfo'),
self.GetRequestEmail(),
topics_text)
*** cron/crontab.in~ Fri Apr 3 03:16:29 1998
--- cron/crontab.in Thu Apr 16 20:52:38 1998
*** 2,8 **** 0 17 * * * /usr/local/bin/python /home/mailman/mailman/cron/checkdbs # # Noon, mail digests for lists that do periodic as well as threshhold delivery. ! 0 12 * * * /usr/local/bin/python /home/mailman/mailman/cron/checkdigests # # 5 AM on the first of each month, mail out password reminders. 0 5 1 * * /usr/local/bin/python /home/mailman/mailman/cron/mailpasswds --- 2,8 ---- 0 17 * * * /usr/local/bin/python /home/mailman/mailman/cron/checkdbs # # Noon, mail digests for lists that do periodic as well as threshhold delivery. ! 0 12 * * * /usr/local/bin/python /home/mailman/mailman/cron/senddigests # # 5 AM on the first of each month, mail out password reminders. 0 5 1 * * /usr/local/bin/python /home/mailman/mailman/cron/mailpasswds

Here's my incorporations of some of janne's patches.
On 16 Apr 1998, Janne Sinkkonen wrote:
Below is a set of patches to take care of a few bugs. My earlier patch to get rid of extra Re:'s is included in a modified form.
Changes:
- No double Reply-To:'s to list mail. Reply-To:'s in some admin mail still remain.
I used "del msg['reply-to']" instead of iterating over the headers. (I had neglected to change some examples just above the added line that do the iteration, so it makes sense that's what you'd do. They're also changed in my version of the patch.)
- Get rid of extra Re:'s on the subject line. However, leave "Re: PREFIX" instead of "PREFIX Re:" - the latter does not work with some mail readers which use Re: for threading (and there was some strange problems with answering the mail as well).
I'm not doing anything with this one. I don't think mailman should trim extra "Re:"s that someone else added, mailman just should avoid adding extra ones, itself.
- Some people wanted to have Reply-To: in every attachment of a MIME digest (for lists with reply_to_list true).
I have implemented just about what you did, *but* i avoided using an unqualified "except" clause. Unqualified except clauses are often evil
- they tend to hide bugs, like taking a pain killer to battle heart disease, it's almost always better to see the symptoms.
- A bug in digest topic section (wrong argument order to ""%(...)) corrected. Some polishing of the header (to make it more useful to the most helpless non-WWW-subscribers).
I already put out a patch for the problem (which you had pointed out) on the ftp site - but had different or no polishings. I'll incorporate them soon.
- crontab: the right name of the script is senddigests.
Whoops! Thanks.
Ken
** I hope i got the order of the patch files right! Please double check before applying... **
Index: mm_deliver.py
RCS file: /hosts/parrot/local/cvsroot/mailman/modules/mm_deliver.py,v retrieving revision 1.20 diff -c -r1.20 mm_deliver.py *** mm_deliver.py 1998/04/15 02:53:01 1.20 --- mm_deliver.py 1998/04/23 23:40:24
*** 113,128 **** if remove_to: # Writing to a file is better than waiting for sendmail to exit tempfile.template = tmpfile_prefix +'mailman-digest.' ! for item in msg.headers: ! if (item[0:3] == 'To:' or ! item[0:5] == 'X-To:'): ! msg.headers.remove(item) msg.headers.append('To: %s\n' % self.GetListEmail()) else: tempfile.template = tmpfile_prefix + 'mailman.' if self.reply_goes_to_list: msg.headers.append('Reply-To: %s\n' % self.GetListEmail()) msg.headers.append('Errors-To: %s\n' % self.GetAdminEmail())
tmp_file_name = tempfile.mktemp()
tmp_file = open(tmp_file_name, 'w+')
--- 113,128 ---- if remove_to: # Writing to a file is better than waiting for sendmail to exit tempfile.template = tmpfile_prefix +'mailman-digest.' ! del msg['to'] ! del msg['x-to'] msg.headers.append('To: %s\n' % self.GetListEmail()) else: tempfile.template = tmpfile_prefix + 'mailman.' if self.reply_goes_to_list:
del msg['reply-to'] msg.headers.append('Reply-To: %s\n' % self.GetListEmail())
msg.headers.append('Errors-To: %s\n' % self.GetAdminEmail())
msg.headers.append('X-BeenThere: %s\n' % self.GetListEmail())
tmp_file_name = tempfile.mktemp()
tmp_file = open(tmp_file_name, 'w+') Index: mm_digest.py
RCS file: /hosts/parrot/local/cvsroot/mailman/modules/mm_digest.py,v retrieving revision 1.18 diff -c -r1.18 mm_digest.py *** mm_digest.py 1998/04/22 16:33:39 1.18 --- mm_digest.py 1998/04/23 22:27:00
*** 97,107 ****
body = self.QuoteMime(post.body)
topics_file.write(" %d. %s (%s)\n" % (self.next_post_number,
subject, sender))
! digest_file.write("--%s\n\nMessage: %d"
! "\nFrom: %s\nDate: %s\nSubject: %s\n\n%s" %
! (self._mime_separator, self.next_post_number,
! fromline, date, subject,
! body))
self.next_post_number = self.next_post_number + 1
topics_file.close()
digest_file.close()
--- 97,112 ----
body = self.QuoteMime(post.body)
topics_file.write(" %d. %s (%s)\n" % (self.next_post_number,
subject, sender))
! if self.reply_goes_to_list:
! maybe_replyto=('Reply-To: %s\n'
! % self.QuoteMime(self.GetListEmail()))
! else:
! maybe_replyto=''
! digest_file.write("--%s\n\nMessage: %d"
! "\nFrom: %s\nDate: %s\nSubject: %s\n%s\n%s" %
! (self._mime_separator, self.next_post_number,
! fromline, date, subject, maybe_replyto,
! body))
self.next_post_number = self.next_post_number + 1
topics_file.close()
digest_file.close()
participants (2)
-
Janne Sinkkonen
-
Ken Manheimer