commit 946458af1f0ddf2a5a85e4ce0d7877828450de66
parent 6f6b5a7f412a4c0ff42a529eabf57cf44bc00af4
Author: Josuah Demangeon <mail@josuah.net>
Date: Mon, 3 Dec 2018 01:20:31 +0100
bin/mail-*: reply to mail with auto Subject
Diffstat:
7 files changed, 55 insertions(+), 5 deletions(-)
diff --git a/bin/mail-filter b/bin/mail-filter
@@ -12,7 +12,7 @@ cd $MAILDIR
fdmove -c 1 2
forbacktickx -n x { ls ${MBLAZE}/sort } importas target x
-if { mmkdir -p -m 0700 ${target}/cur ${target}/new ${target}/tmp }
+if { mkdir -p -m 0700 ${target}/cur ${target}/new ${target}/tmp }
if { fdmove -c 1 2 printf "%-35s " $target }
backtick -n x {
diff --git a/bin/mail-gpg-decrypt b/bin/mail-gpg-decrypt
@@ -0,0 +1,24 @@
+#!/bin/sh -e
+fdmove -c 2 1
+
+backtick -n x { mktemp }
+importas tmp x
+
+ifte { rm -f ${tmp} } { rm -f ${tmp} }
+
+backtick -n x {
+ pipeline { tee ${tmp} }
+ awk -F: "
+ /: application\/pgp-encrypted/ { supported = 1; }
+ /: application\/octet-stream/ { if (supported) print $1; }
+ "
+}
+importas n x
+
+ifelse { test ${n} } {
+ pipeline { mshow -O ${tmp} ${n} }
+ gpg -d
+ exit 64
+}
+
+exit 0
diff --git a/bin/mail-head b/bin/mail-head
@@ -0,0 +1,24 @@
+#!/usr/bin/env execlineb
+
+define FORMAT " %t %s\\n %D %40f\\n"
+
+backtick -n x { whoami }
+importas USER x
+backtick -n x { homeof ${USER} }
+importas HOME x
+importas -D ${HOME}/mail MAILDIR MAILDIR
+
+cd ${MAILDIR}
+
+if { echo }
+forbacktickx -o 0 x { ls }
+importas box x
+
+backtick -n x { pipeline { mlist -i ${box} } sed "s/ *[^ ]*$//" }
+importas count x
+if { printf " \033[1m%-30s\033[m %s\n\n" ${box} ${count} }
+if {
+ pipeline { mlist -s ${box} }
+ pipeline { msort -d }
+ mscan -f ${FORMAT}
+}
diff --git a/bin/mail-rep b/bin/mail-rep
@@ -30,6 +30,7 @@ backtick -n -D ${From} To {
}
backtick -n From { mhdr -h local-mailbox ${MBLAZE}/profile }
+backtick -n Subject { mscan -f %S ${mail} }
backtick -n Message-Id { mhdr -d -h message-id ${mail} }
backtick -n Date { mdate }
export Body ${mail}
@@ -41,7 +42,7 @@ if {
redirfd -c 1 ${draft}
if { echo "${From}:" }
pipeline { mshow -R ${mail} }
- sed "1,/^$/ d; s/^/> /; s/ *$//"
+ sed "s/^/> /; s/ *$//"
}
mail-draft ${draft}
diff --git a/dot/mblaze/filter b/dot/mblaze/filter
@@ -1,2 +1 @@
-application/octet-stream: gpg -d
-application/pgp-encrypted: gpg -d
+application/pgp-encrypted: mail-gpg-decrypt
diff --git a/dot/mblaze/sort/mailer-daemon b/dot/mblaze/sort/mailer-daemon
@@ -0,0 +1 @@
+"From" ~~~ "MAILER-DAEMON@*"
diff --git a/dot/mblaze/sort/transports b/dot/mblaze/sort/transports
@@ -7,4 +7,5 @@
"From" ~~~ "*ouigo*" ||
"From" ~~~ "*sncf.com*" ||
"From" ~~~ "*sobus.com*" ||
-"From" ~~~ "*trainline.com*"
+"From" ~~~ "*trainline.com*" ||
+"From" ~~~ "*trainline.eu*"