X-Git-Url: https://git.distorted.org.uk/~mdw/exim-config/blobdiff_plain/28cfda76882f2c67fbda20831352cc7f65e64ad2..1e5ccd7c52be79d1de45691a0bb46cbb1a686bf0:/defs.m4 diff --git a/defs.m4 b/defs.m4 index c289385..370c2d3 100644 --- a/defs.m4 +++ b/defs.m4 @@ -73,6 +73,19 @@ m4_pushdef(<:_foreach_func:>, <:$1:>)m4_dnl _FOREACH($2)<::>m4_dnl m4_popdef(<:_foreach_func:>):>) +## CLRSEP +## +## Clear the separator. Use in conjunction with `SEP' below. +m4_define(<:CLRSEP:>, <:m4_define(<:__sep:>, <::>):>)m4_dnl + +## SEP(newsep) +## +## Insert the current separator, and then set the separator to NEWSEP. This +## is handy in `FOREACH' loops, in order to separate the items with the +## correct number of fenceposts: call `CLRSEP' before the list, and begin +## each item with SEP(...). +m4_define(<:SEP:>, <:__sep<::>m4_define(<:__sep:>, <:$1:>):>)m4_dnl + ## DIVERT(name) ## ## Make _div:NAME be the current diversion. @@ -99,6 +112,30 @@ m4_ifdef(<:_done:$1/$2:>, <::>, <:m4_dnl m4_ifdef(<:_head:$1/$2:>, <:<:##:> m4_indir(<:_head:$1/$2:>) :>)m4_define(<:_done:$1/$2:>):>):>):>) +## ADD_HEADER(hdrs) +## +## An ACL action to add the given HDRS, which are a `\n'-terminated list of +## new header lines. +m4_define(<:ADD_HEADER:>, <:m4_dnl + set acl_m_hdradd = ${if def:acl_m_hdradd{$acl_m_hdradd}{}}$1\n:>) + +## RENAME_HEADERS_ADD(list) +## +## Return a newline-separated list of message header additions of the form +## X-Distorted-Renamed-HEADER: VALUE +## for each HEADER in the LIST which appears in the current message, where +## VALUE is the HEADER's current value. +m4_define(<:RENAME_HEADERS_ADD:>, <:m4_dnl +FOREACH(<:\ + ${if def:h_$:><:1:{X-CONF_header_token-Renamed-$:><:1: $h_$:><:1:\n}}:>, + <:$1:>):>) + +## RENAME_HEADERS_REMOVE(list) +## +## Return the LIST, with items separated by colons. +m4_define(<:RENAME_HEADERS_REMOVE:>, <:m4_dnl +CLRSEP<::>FOREACH(<:SEP(:)$:><:1:>, <:$1:>):>) + ## LOOKUP_DOMAIN(dom, [if-found], [if-not-found]) ## ## Look up DOM in the master domains file. If it's found, put the