From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id A197F1F4B5; Sun, 17 Nov 2019 01:24:04 +0000 (UTC) Date: Sun, 17 Nov 2019 01:24:04 +0000 From: Eric Wong To: meta@public-inbox.org Subject: Re: Filter example for ML footers Message-ID: <20191117012404.GA427@dcvr> References: <20191116175251.ykhpp6zuo5f6kqiy@chatter.i7.local> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20191116175251.ykhpp6zuo5f6kqiy@chatter.i7.local> List-Id: Konstantin Ryabitsev 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)