• Custom cleanfeed rules

    From Grant Taylor@21:1/5 to All on Mon Jul 11 18:17:34 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From yamo'@21:1/5 to All on Tue Jul 12 10:30:18 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Grant Taylor@21:1/5 to yamo' on Tue Jul 12 09:34:40 2022
    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. :-)



    --
    Grant. . . .
    unix || die

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From yamo'@21:1/5 to All on Wed Jul 13 09:14:01 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Grant Taylor@21:1/5 to yamo' on Wed Jul 13 10:09:00 2022
    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.



    --
    Grant. . . .
    unix || die

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)