Auteur: Pat Lashley Date: À: Robert Kehl, exim-users Sujet: Re: [Exim] Multi-condition ACL statement in a macro possible?
--On Sunday, September 14, 2003 13:57:09 +0200 Robert Kehl
<mailinglists@???> wrote:
> ----- Original Message -----
> From: "Pat Lashley" <patl+cyrus@???>
> Sent: Saturday, September 13, 2003 8:01 AM
> Subject: [Exim] Multi-condition ACL statement in a macro possible?
>
>
>> warn message = X-Test: YES
>> condition = ${if {$h_subject}{macro test}{yes}{no}}
>>
>> No matter what combination of \ and \n I try, it seems to always
>> make the condition part of the X-Test header's value. Or an "unknown
>> ACL condition/modifier" error message.
>
> This is the intended behaviour IMHO. A macro simply substitutes it's
> name through it's exact contents. An example - you define a multiline
> macro using \ like this:
No, I'd expect the backslash at the end of the line to cause the line
concatenation at the time when the macro is defined. The real difficulty
is that \n is not converted to NEWLINE during macro definition; so it
remains escaped when the macro is expanded. Basicly, it looks like
a macro always expands to a single line (or part of one if surrounded
by other text.) What I need is a way to expand the macro to multiple
lines.
> The \ won't be touched, it appears in the result as it appears in the
> macro. To get around this, define each line as a single macro and omit
> the \ like shown below:
>
> MYMACRO1=warn message = X-Test: YES
> MYMACRO2=condition = ${if {$h_subject}{macro test}{yes}{no}}
>
> acl:
> MYMACRO1
> MYMACRO2
> log_message = mymacro triggered.
>
> This yields:
> warn message = X-Test: YES
> condition = ${if {$h_subject}{macro test}{yes}{no}}
> log_message = mymacro triggered.
>
> Bingo. But now you have two macros for one condition instead of one,
> that's not nice, but I don't know of a way to overcome this.
If I always wanted to expand to only two lines I might consider this;
but the ACL statement I posted was a simplified example; and the total
number of lines varies.
I know I can do it by having the macro expand to a .include statement;
but I was hoping to avoid multuplying the number of included files.