[Mailman-Developers] Re: Subject Cleanup Routine

Dan Delaney Dionysos@Dionysia.org
Thu, 29 Jul 1999 13:27:33 -0400 (EDT)


From: Harald Meland
> So, if I send a mail with subject
>   Subject: Administrivia: [foo] will be changed to [bar]
> Mailman should change it to
>   Subject: [foo] Administrivia: will be changed to [bar]
> 
> ?  I don't think messing with the subject prefix to that extent is
a
> good idea.

First, how often are you really gonna put the list's prefix in the
subject of a message to the list? Not very often. Maybe once in the
lifetime of the list, if that often? Second, even if you do need to
refer to the list name in the subject, you could just use quotes
instead of brackets, as in:

   Subject: [foo] Administrivia: "foo" will be changing to "bar"

I don't think that's really that big a deal.

> Regarding stripping of consecutive "Re:" and "Fwd:"
> strings -- you'd still have problems with the nationalized
versions of
> these ("SV:", "AD:", etc.) that some MUA vendors in their infinite
> wisdom have implemented

That's a good point. Maybe on the options page there could be a list
of "subject tags" to strip from the subjects, instead of having them
hard coded in the program.

> I think this "problem" should be solved in the user's MUA
> configuration (if the user wants the subjects mangled) and/or in
the
> archiver thread generator.

Unfortunately the MUAs out there do a crappy job of this. Look at
how many messages you get with things like "Re: Fwd: RE:" in the
subject. I get a lot, and it's awefully annoying.

Anyway. What would be nice would be a radio button option in the
General Options to choose between the existing routine, which simply
checks to see if the Prefix is already present in the subject, and a
the more aggressive subject cleanup routine. Here, by the way, is a
new copy of the routine which takes into account those aweful
NUMBERED reply tags (as in "Re[2]:"):

---------------------------------------------------------------------------
# Prepend the subject_prefix to the subject line.
subj = msg.getheader('subject')
prefix = self.subject_prefix
# If there's no subject, give it one
if not subj:
    msg.SetHeader('Subject', '%s(no subject)' % prefix)
else:
    # Delete all occurances of the prefix from the subject
    if prefix:
        subj = re.sub(re.escape(self.subject_prefix), '', subj)
    # Check to see if the message is a reply or forward
    prefix2 = ''
    if re.search('^fwd*[0-9\[\]]*: |\(fwd\)', subj, re.I):
        prefix2 = 'Fwd: '
    if re.match('re[0-9\[\]]*: ', subj, re.I):
        prefix2 = 'Re: '
    # Clean up all that 're:' and 'fwd: ' garbage
    subj = re.sub('[rR][eE][0-9\[\]]*: | *\(*[fF][wW][dD]*[0-9\[\]\)]*:* *', '', subj)
    # Set the new subject line in place
    msg.SetHeader('Subject', '%s%s%s' % (prefix, prefix2, subj))
---------------------------------------------------------------------------


-- Dan
________________________________________________________________________
 Dionysos@Dionysia.org                                Daniel G. Delaney
 www.Dionysia.org/~dionysos/
 PGP Public Key: /~dionysos/pgp.html