Re: [exim] Weird errors with conditions

Pàgina inicial
Delete this message
Reply to this message
Autor: Yves Goergen
Data:  
A: Jakob Hirsch
CC: exim-users
Assumpte: Re: [exim] Weird errors with conditions
On 20.09.2005 16:51 (+0200), Jakob Hirsch wrote:
> A string (or even a "fail") is not a condition you can use in "if". If you
> want to check if the lookup succeeded you have to use a condition, e.g.
> "eq":
>
> ${if eq {${lookup ...{1}{0}}} {1}}
>
> "condition" in an ACL only expects something like 1, 0, yes or no. You can
> rewrite it like that:
>
> ${if eq {$recipients_count}{1} \
> {${lookup mysql{MYSQL_Q_SPAMFILTER} {1}}}}


The database query will return "0" or "1" or an error if the record is
not found, but in this case (for local recipients) it will be found.
(Otherwise it would be no local recipient.)

This is my next try:
> condition = ${if and {{eq {$recipients_count} {1}} \
>                       {${lookup mysql{MYSQL_Q_SPAMFILTER} {$value} {0}}}} \
>                  {true}}


And here's the error:
> temporarily rejected after DATA: failed to expand ACL string "${if and {{eq {$recipients_count} {1}} {${lookup mysql{SELECT spamfilter FROM users WHERE CONCAT(local, "@", domain)='${quote_mysql:$recipients}' LIMIT 1} {$value} {0}}}} {true}}": condition name expected, but found "${lookup mysql{S" inside "and{...}" condition


What is a "condition name"? Isn't the syntax like this:
    and {{cond1} {cond2}}
and for conditions:
    ${if {cond} {truepart} [{falsepart}]}


I guess additional spaces between all that braces don't matter. That
makes it a bit easier to read.

--
Yves Goergen "LonelyPixel" <nospam.list@???>
"People think I've stopped lying... but I've just gotten better at it."
http://newsboard.unclassified.de - Unclassified NewsBoard Forum