user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* Filter example for ML footers
@ 2019-11-16 17:52 Konstantin Ryabitsev
  2019-11-17  1:24 ` Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Konstantin Ryabitsev @ 2019-11-16 17:52 UTC (permalink / raw)
  To: meta

Hello:

Groups.io adds a super-obnoxious footer to all outgoing messages, and I 
would like to be able to filter that out. Example:

https://lore.kernel.org/keys/20191111161300.hc7vb7rcb45gsqmg@chatter.i7.local/

The obnoxious footer can be either part of the main body (default
"chaotic evil" version) or a separate mime-part (configurable, "lawful 
evil").

I tried to wrap my brain around existing filters, but they don't quite 
do the exact thing I need, specifically:

- if there is a text/plain mime-part with just "^-=-=.*=-=-$", remove it
- if there is no more content left after removing the footer, nuke the 
  entire mime-part

Any quick pointers how this can be accomplished? 

TIA.

-K

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Filter example for ML footers
  2019-11-16 17:52 Filter example for ML footers Konstantin Ryabitsev
@ 2019-11-17  1:24 ` Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2019-11-17  1:24 UTC (permalink / raw)
  To: meta

Konstantin Ryabitsev <konstantin@linuxfoundation.org> wrote:
> Hello:
> 
> Groups.io adds a super-obnoxious footer to all outgoing messages, and I 
> would like to be able to filter that out. Example:
> 
> https://lore.kernel.org/keys/20191111161300.hc7vb7rcb45gsqmg@chatter.i7.local/
> 
> The obnoxious footer can be either part of the main body (default
> "chaotic evil" version) or a separate mime-part (configurable, "lawful 
> evil").
> 
> I tried to wrap my brain around existing filters, but they don't quite 
> do the exact thing I need, specifically:
> 
> - if there is a text/plain mime-part with just "^-=-=.*=-=-$", remove it
> - if there is no more content left after removing the footer, nuke the 
>   entire mime-part
> 
> Any quick pointers how this can be accomplished? 

Maybe check the call to ->walk_parts and ->body_str_set in
lib/PublicInbox/Filter/RubyLang.pm.

Also, historical versions of lib/PublicInbox/Filter.pm
did a lot more with MIME parts replacment and removal:
https://public-inbox.org/meta/8b78a44163743dcd4a235a1bc661471e29f091e6/s/
(but was too intrusive with DKIM)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-17  1:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-16 17:52 Filter example for ML footers Konstantin Ryabitsev
2019-11-17  1:24 ` Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).