defs.m4, local.m4: Abstract out machinery for header-renaming lists.
[exim-config] / defs.m4
diff --git a/defs.m4 b/defs.m4
index f2767fd..289dd52 100644 (file)
--- a/defs.m4
+++ b/defs.m4
@@ -112,6 +112,23 @@ m4_ifdef(<:_done:$1/$2:>, <::>, <:m4_dnl
 m4_ifdef(<:_head:$1/$2:>, <:<:##:> m4_indir(<:_head:$1/$2:>)
 :>)m4_define(<:_done:$1/$2:>):>):>):>)
 
+## 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
+CLRSEP<::>FOREACH(<:\
+       ${if def:h_$:><:1:{X-Distorted-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