> I tried to write a filter with pre-defined variables, if the following
rules work,
> I should see "Blocked Senders" from dnews_post.log when User1 or User2
post a message
> to local.chat, but line 2 doesn't work. so I have to use line 3 and line 4
to
> block them.
>
> what's wrong with line2? Could someone please advice me? Thanks!
>
> $block_sender = "User1,User2"
>
> 1. if (match("Newsgroups","local.chat")) then
> 2.   if (matchone("From",$block_sender)) reject "Blocked Senders" else
> 3.   if (isin("From","User1")) reject "Blocked User1" else
> 4.   if (isin("From","User2")) reject "Blocked User2" else
> 5. end if

Hi,

Did you try the following?

if (match("Newsgroups","local.chat")) then
    if (matchone("From",$block_sender)) reject "Blocked Senders"
end if

I.e. without the 'else' on line two?

I don't believe Dnews supports 'else if' in the way some programming
languages do (although those that do require 'else if' to appear on the same
line), so the final solution you came up with is not strictly correct. Each
'if...else' must be paired with an 'end if'.

You can test rules from the command line using -

    tellnews rules_trace c:\rul.txt c:\test.txt

Where rul.txt is the rule file you wish to test, and test.txt is the full
article to test (including headers).

This will show you when the message was excepted or rejected by the filter
and you can address those issues more directly.

As a general suggestion you may prefer to use matchone() on the group check
instead of match() as if the user cross posts to the specified group, the
filter will not be applied (as match only matches the whole header).

- Roydon L.


Reply via email to