[Mailman-developers] Subject line, Re:, subject prefix (a small patch)

Janne Sinkkonen janne@avocado.pc.helsinki.fi
16 Apr 1998 18:46:43 +0300


Here's a patch to get rid of extra Re:'s around the beginning of the
subject line. I don't know whether this replaces too aggressively or
not (I'm testing it on a largish mailing list). Probably not. Another
question is that should we have 

     Re: PREFIX .*
 
or 
     PREFIX Re: .*

in replies. I'd maybe favor the latter (this is also what the patch
implements).

*** maillist.py Thu Apr 16 18:38:02 1998
--- maillist.py~        Sun Apr 12 07:34:01 1998
***************
*** 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, prefix + 'Re: ', subj)
!             else:
!                # No prefix yet.
!                subj=prefix+subj
!           msg.SetHeader('Subject', subj)
  
        if self.digestable:
            self.SaveForDigest(msg)
--- 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)



-- 
Janne Sinkkonen      <janne@iki.fi>      <URL: http://www.iki.fi/~janne/ >