[exim-dev] [Bug 458] Various expansion items and conditions …

Startseite
Nachricht löschen
Nachricht beantworten
Autor: bug458
Datum:  
To: exim-dev
Alte Treads: [exim-dev] [Bug 458] New: Expansion condition: forall and/or forany
Betreff: [exim-dev] [Bug 458] Various expansion items and conditions iterating over lists
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.

http://www.exim.org/bugzilla/show_bug.cgi?id=458





------- Comment #16 from bugzilla.exim.simon@??? 2007-02-10 19:44 -------
I'd like a ${map{<string1>}{<string2>}} to convert a list of recipients to a
list of numbers, and then a way to find the minimum/maximum of that list... so
I can avoid this mess:

    set acl_m1  = \
        # figure out the maximum score
        ${perl{compute_score}{\
            # convert the list of recipients into a list of spam rejection
scores
            ${expand:\
                # <start>
                \N${sg{\N\
                # </start>
                ${sg{${lc:$recipients}}{, }{\\N\
                    # <end>
                    \N}{^(.*)@(.*)\$}{\N\


\N\$\{lookup\{\$2\}lsearch\{/etc/exim/conf/domains\}\{\N\

\N\$\{lookup\{\$1\}partial0-lsearch\{/etc/exim/conf/\$2/acls\}\{\N\

\N\$\{lookup\{\$value\}lsearch*\{/etc/exim/conf/acls/spam\}\{\N\

\N\$\{extract\{reject\}\{\$value\}\{\$value\}\{0\}\}\N\
                                \N\}\{0\}\}\N\
                            \N\}\{0\}\}\N\
                        \N\}\{0\}\}\N\
                    \N}}\N\
                    # </end>
                    \N \N\
                    # <start>
                    \N${sg{\N\
                    # </start>
                \\N}}\
                # <end>
                \N}{^(.*)@(.*)\$}{\N\
                    \N\$\{lookup\{\$2\}lsearch\{/etc/exim/conf/domains\}\{\N\


\N\$\{lookup\{\$1\}partial0-lsearch\{/etc/exim/conf/\$2/acls\}\{\N\

\N\$\{lookup\{\$value\}lsearch*\{/etc/exim/conf/acls/spam\}\{\N\

\N\$\{extract\{reject\}\{\$value\}\{\$value\}\{0\}\}\N\
                            \N\}\{0\}\}\N\
                        \N\}\{0\}\}\N\
                    \N\}\{0\}\}\N\
                \N}}\N\
                # </end>
            }\
        }}


I wouldn't suggest trying to understand that, but it does work. It uses lsearch
to find the acl name for a recipient spam score and then finds the reject score
to use. I had to resort to perl to figure out which value was the maximum.

--
Configure bugmail: http://www.exim.org/bugzilla/userprefs.cgi?tab=email