mhonarc-users

Re: Cutting lines (removing signature)

2003-09-16 11:16:39
On September 16, 2003 at 16:35, "Jeroen " FF " Heijmans" wrote:

I made a copy of mhtxtplain.pl to my-txtplain.pl with the same
user:group and permissions.

I added your line in front of the first $$data tag:
(this one)
# <CR><LF> => <LF> to make parsing easier
$$data =~ s/\r\n/\n/g;

I added next lines as first ones in my blog.mrc (from the site):
<MIMEFilters>
application/x-patch;     m2h_text_plain::filter;      my-txtplain.pl
message/delivery-status;   m2h_text_plain::filter;    my-txtplain.pl
message/partial;         m2h_text_plain::filter;      my-txtplain.pl
text/*;                          m2h_text_plain::filter;      my-txtplain.pl
text/plain;              m2h_text_plain::filter;      my-txtplain.pl
x-sun-attachment;        m2h_text_plain::filter;      my-txtplain.pl
</MIMEFilters>

But still the signatures stay in de posts.
I'm I doing stuff on the wrong lines ?

Existing archived messages will not be affected, only newly archived
messages.  You'll have to do a rebuild from original data if you want
existing messages to be affected.

BTW, a better way to implement my-txtplain.pl is something like
the following:

  package iy_text_plain;

  sub filter {
    my($fields, $data, $is_decoded, $filter_args) = @_;

    # strip signature
    $$data =~ s/\r\n/\n/g;
    $$data =~ s/^-- \n[\s\S]*//m;

    # call mhonarc's default filter to do everything else
    require mhtxtplain.pl;
    return m2h_text_plain::filter($fields, $data, $is_decoded, $filter_args);
  }

And then register via MIMEFILTERS:

  <MIMEFilters>
  application/x-patch;     my_text_plain::filter;       my-txtplain.pl
  message/delivery-status; my_text_plain::filter;       my-txtplain.pl
  message/partial;         my_text_plain::filter;       my-txtplain.pl
  text/*;                  my_text_plain::filter;       my-txtplain.pl
  text/plain;              my_text_plain::filter;       my-txtplain.pl
  x-sun-attachment;        my_text_plain::filter;       my-txtplain.pl
  </MIMEFilters>

With this implementation, your customization will inherit any new
capabilities (and bug fixes) of the default plain text filter without
have to update your filter each time you upgrade mhonarc.

--ewh

---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-USERS