[antispam-f] Re: / in rules

  • From: Jeremy C B Nicoll <Jeremy@xxxxxxxxxxxxxxxx>
  • To: antispam@xxxxxxxxxxxxx
  • Date: Thu, 14 Dec 2006 21:14:56 +0000 (GMT)

In article <1b0e12954e.ricp@xxxxxxxxxxxxxxxxxxxxx>,
   Richard Porter <ricp@xxxxxxxxxxxxxxxx> wrote:

> OK, but then it needs to be made clear that if you need to put // in 
> the criterion it must be preceded with a comment.

It's always been clear with my version; doc for this came with the
set-up notes.

> >> > or better still, do without comments before rules
> > 
> > Why - they're useful when individual rules need explanations.

> Have comments after the rule. Admittedly you then need some delimiter 
> from the rule other than a new line, but at lease you keep the rules 
> lined up nicely without lots of redundant spaces.

Things are lined up here very nicely thank-you.  (And indeed nicely
syntax-coloured too).



> >> > or have an escape sequence for /,
> > 
> > It's not needed.

> It's not needed because you have to fudge it with a preceding comment.

Charming.  It's not a fudge, it's a deliberate design decision.  And,
when I added it, I was trying to add features in *my* version, for *my*
use, in a way that didn't materially alter the logic in DH's code. 

Of coure I could have done it some other way, eg using an escape
sequence.  But then I'd need to explain escape sequences to people who
used my version.  If you think that what I did is a fudge maybe you'd
like to explain escapes to people who don't understand that kind of
thing (the same ones who will never ever use regex for example)?   


> > The only problem here is that you hadn't read about the feature, or
> > had forgotten it existed.
> > 
> >> > My preference is to have a comment after the rule, not in front
> >> > of it.

Fine.  Alter the code and then maintain that change if you want.


> > I don't see a problem provided users read the manual.

> The point I was making at the top is that if you want to find out
> what is allowed inside "criterion" you shouldn't have to look under
> "comments". I took the obvious path of Rules -> Syntax -> criterion
> and found nothing to indicate that I couldn't use //. Even the bit at
> the top of "Rules file syntax" just says that "Lines beginning with
> | are _comments_." It doesn't say anything about // so I had no
> reason to go there and never suspected that this was the problem.

Well the manual you get with Frank's code is Frank's manual.

My version of AS didn't have a specific manual at all apart from the
one supplied by Dave Higton with the version of AS on which my version
was based.  But my version did come with separate documentation
describing all the differences, the reasons for them, and - where
possible - how to turn features on and off and work around their
problems.

As soon as the possibility of regex being added to AS was mentioned
last month, I thought the "//" logic might produce some problems for
people. I downloaded Frank's code and had a quick look at the manual.
I suggested that it might be useful to remind people of this feature,
partly because it allows a short description of what a pattern is
trying to do to be put on each regex rule line.  I also noticed that
there wasn't a mention of the // feature and suggested addition of the
following to the "comments" help text:

     It's also possible to put a short comment in front of a single
     rule.  This kind of comment does not start with a "|" character
     as if it did then AntiSpam would ignore the whole line.

     Instead you mark the point where the comment ends and the rule
     itself starts, with two consecutive forward slashes, eg:

       some comment text // DELETE Subject: = *whatever*

     Why would you want to do this?  Well it's useful for rules where
     you won't necessarily remember why you set them up, eg accept
     rules for mails from people whose email addresses are not very
     memorable, eg:

       John Smith    //  Accept From: = xyz123@xxxxxxxxxx
       Peter Doe     //  Accept From: = pqr992@xxxxxxxxxxxxx


     Of course, if you want an ordinary rule to include a pair of
     forward slashes you can't just write something like:

       DELETE Subject: = * abcd // efgh *

     because AntiSpam will chop off all the text up to the // before
     trying to understand the rule.  As far as it is concerned this
     example rule might just as well have been written as:

       efgh *

     But all you need to do in this case is rewrite the rule with a
     leading comment, eg:

        some explanation //  DELETE Subject: = * abcd // efgh *

     as AntiSpam will then chop off the initial comment and process
     the rest of the rule line.

-- 
Jeremy C B Nicoll, Edinburgh, Scotland - my opinions are my own.

Other related posts: