mhonarc-users

RE: removing subject header (+another question)

1998-06-15 11:36:35
----------
From:         Earl Hood[SMTP:ehood(_at_)hydra(_dot_)acs(_dot_)uci(_dot_)edu]

On June 15, 1998 at 03:51, S P Arif Sahari Wibowo wrote:

On Mon, 15 Jun 1998, Vincent wrote:

I have a mailing list which automatically puts the name of 
        > >the list at the beginning of each message subject. I would 
        > >like to have mhonarc remove this automatically when creating 
        > > the archives. 

I don't think MHonArc can do that.
You will have to create a filter program (with sed or perl) [...]

Or, if you know a little Perl, you can modify the code to do
what you want.  The place to do it is in mhamain.pl and in the
routine read_mail_header().  Just add your code after the part
where the subject is extracted; there are comments in the routine,
so it should be easy to spot.

I thought I'd take a shot at this...

Here's the original code from mhamail.pl (starting at line 832)

    ##-------------##
    ## Get Subject ##
    ##-------------##
    if ($fields{'subject'} !~ /^\s*$/) {
        ($sub = $fields{'subject'}) =~ s/\s*$//;
    } else {
        $sub = 'No Subject';
    }

You could add a couple of lines after the 
  
   ($sub = $fields{'subject'}) =~ s/\s*$//;

as follows:

    ##-------------##
    ## Get Subject ##
    ##-------------##
    if ($fields{'subject'} !~ /^\s*$/) {
        ($sub = $fields{'subject'}) =~ s/\s*$//;
      $tag = 'string to be removed';
      $pat = quotemeta $tag;
      $sub =~ s/$pat//;
    } else {
        $sub = 'No Subject';
    }

While we're in the neighborhood...

Earl, I know you pointed me at this before, but I lost my notes
and I know you reorganized the code somewhat for 2.2.0.

While I want subject lines to display in mixed case in 
the archive (just like they appear in the mail), I like the
subject-based threading to be case insensitive...

Where about was that code again?

Simeon


<Prev in Thread] Current Thread [Next in Thread>