Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Custom cleanfeed rules

3 views
Skip to first unread message

Grant Taylor

unread,
Jul 11, 2022, 8:17:08 PM7/11/22
to
Hi,

Can anyone point me in a direction to start creating my own custom
cleanfeed rules?

I'd like to translate what -- I think -- is a simple filter in
Thunderbird to be a cleanfeed rule to reject posts at thee server.

subject contains "blank"
subject contains "card"
subject doesn't start with "re"
from contains "@gmail.com"

I'm also okay if the "doesn't start with" is a less precise "doesn't
contain".

Thank you for any pointers you can offer.



--
Grant. . . .
unix || die

yamo'

unread,
Jul 12, 2022, 4:30:19 AM7/12/22
to
Hi,
Grant Taylor a tapoté le 12/07/2022 02:17:
> Can anyone point me in a direction to start creating my own custom
> cleanfeed rules?
>
> I'd like to translate what -- I think -- is a simple filter in
> Thunderbird to be a cleanfeed rule to reject posts at thee server.

In cleanfeed.local

Into the function local_filter_last
>
> subject contains "blank"
> subject contains "card"
> subject doesn't start with "re"
> from contains "@gmail.com"

if ($hdr{From} =~ /\@gmail/) {
if (not $hdr{Subject} =~ /^re/i) {
if ( $hdr{Subject} =~ /card/i) {
if ( $hdr{Subject} =~ /card/i) {
return reject( 'Bad post!');
}

}
}
};


> I'm also okay if the "doesn't start with" is a less precise "doesn't
> contain".
>
> Thank you for any pointers you can offer.



I'm sure that someone will give a two or three lines solution...



--
Stéphane

Grant Taylor

unread,
Jul 12, 2022, 11:34:14 AM7/12/22
to
On 7/12/22 2:30 AM, yamo' wrote:
> Hi,

Hi Stéphane,

> In cleanfeed.local
>
> Into the function local_filter_last
>
> if ($hdr{From} =~ /\@gmail/) {
> if (not $hdr{Subject} =~ /^re/i) {
> if ( $hdr{Subject} =~ /card/i) {
> if ( $hdr{Subject} =~ /card/i) {
> return reject( 'Bad post!');
> }
>
> }
> }
> };

Thank you for that example.

I believe I understand it well enough to make the following bug report.

It looks like you're checking if the Subject header contains a case
insensitive "card" string twice. I suspect you copy and pasted lines
and meant to change one of them to "blank". ;-)

I believe I will be able to take your good example and add it to my
cleanfeed.local file.

> I'm sure that someone will give a two or three lines solution...

I could be ornery and say that there's no possible way to do that,
thereby guaranteeing that multiple people will prove me wrong. }:-)

Thank you again Stéphane. :-)

yamo'

unread,
Jul 13, 2022, 3:14:02 AM7/13/22
to
Hi Grant,

Grant Taylor a tapoté le 12/07/2022 17:34:

> It looks like you're checking if the Subject header contains a case
> insensitive "card" string twice. I suspect you copy and pasted lines
> and meant to change one of them to "blank". ;-)
>

Yes, it's a big source of bugs...


Maybe you can simplify the two copied pasted rules by this one :

if ( $hdr{Subject} =~ /blank.{0,50}card|card.{0,50}blank/i) {


> I believe I will be able to take your good example and add it to my
> cleanfeed.local file.

Local rules work well!
--
Stéphane

Grant Taylor

unread,
Jul 13, 2022, 12:08:33 PM7/13/22
to
On 7/13/22 1:14 AM, yamo' wrote:
> Hi Grant,

Hi Stéphane,

> Yes, it's a big source of bugs...

:-)

> Maybe you can simplify the two copied pasted rules by this one :
>
> if ( $hdr{Subject} =~ /blank.{0,50}card|card.{0,50}blank/i) {

I probably could.

I use regular expressions extensively. But I've learned that it's
better for me if I try to avoid over optimizing REs. Instead, my
ability to maintain them long term is greatly enhanced if I keep them as
a set of multiple simpler REs rather than a single more complex RE.
Maybe that's just me.

> Local rules work well!

I look forward to trying it out as soon as I find a spare Round-Tuit.
0 new messages