about summary refs log tree commit diff
path: root/modules/server/spectrum/spectrumbot/postfix/mda.elb
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2022-03-30 12:59:11 +0000
committerAlyssa Ross <hi@alyssa.is>2022-03-30 13:00:32 +0000
commitf920d5e07c29a9aa1b77d9b88bd604cf1a1f3664 (patch)
tree109965973d8aa3ad92dd59a934391c497f0d8bde /modules/server/spectrum/spectrumbot/postfix/mda.elb
parentb51e32e9b386cf51e80a9f7ad0ab3ea82deb9e76 (diff)
downloadnixlib-f920d5e07c29a9aa1b77d9b88bd604cf1a1f3664.tar
nixlib-f920d5e07c29a9aa1b77d9b88bd604cf1a1f3664.tar.gz
nixlib-f920d5e07c29a9aa1b77d9b88bd604cf1a1f3664.tar.bz2
nixlib-f920d5e07c29a9aa1b77d9b88bd604cf1a1f3664.tar.lz
nixlib-f920d5e07c29a9aa1b77d9b88bd604cf1a1f3664.tar.xz
nixlib-f920d5e07c29a9aa1b77d9b88bd604cf1a1f3664.tar.zst
nixlib-f920d5e07c29a9aa1b77d9b88bd604cf1a1f3664.zip
modules/server/spectrumbot: init
Diffstat (limited to 'modules/server/spectrum/spectrumbot/postfix/mda.elb')
-rw-r--r--modules/server/spectrum/spectrumbot/postfix/mda.elb26
1 files changed, 26 insertions, 0 deletions
diff --git a/modules/server/spectrum/spectrumbot/postfix/mda.elb b/modules/server/spectrum/spectrumbot/postfix/mda.elb
new file mode 100644
index 000000000000..05b111cf59a5
--- /dev/null
+++ b/modules/server/spectrum/spectrumbot/postfix/mda.elb
@@ -0,0 +1,26 @@
+backtick -E path { mktemp }
+if { redirfd -w 1 $path cat }
+foreground { echo "Mail from " $1 }
+if -x 77 { test $1 = IPv6:::1 }
+
+foreground {
+  pipeline -w { nc -N ::1 18770 }
+  pipeline -w { if { tr -d "\n" } echo }
+  backtick list {
+    pipeline { mhdr -h List-Id $path }
+    sed "s/.*<\\([^.>]*\\)[.>].*/\\1/"
+  }
+  if { printf "📨 #ORANGE" }
+  if { printenv list }
+  if { printf "@ #GREEN" }
+  if { maddr -dh from $path }
+  if { printf " #NORMAL#BOLD" }
+  if { mhdr -h Subject $path }
+  if { printf " #NORMAL#BLUE#UNDERLINEhttps://spectrum-os.org/lists/archives/spectrum-" }
+  if { printenv list }
+  pipeline { mhdr -h Message-Id $path }
+  sed "s,.*<\\([^>]*\\)>.*,/\\1/,"
+}
+importas -iu exit ?
+if { rm $path }
+exit $exit