dot

packages and services management
Log | Files | Refs | README

commit 3c8a7e25bc80257979100b4857329386071e14e8
parent 946458af1f0ddf2a5a85e4ce0d7877828450de66
Author: Josuah Demangeon <mail@josuah.net>
Date:   Mon,  3 Dec 2018 02:52:13 +0100

;u;

Diffstat:
Mbin/mail-gpg-decrypt | 33++++++++++++++++++---------------
Abin/mail-gpg-verify | 21+++++++++++++++++++++
Mdot/mblaze/filter | 2+-
3 files changed, 40 insertions(+), 16 deletions(-)

diff --git a/bin/mail-gpg-decrypt b/bin/mail-gpg-decrypt @@ -1,24 +1,27 @@ -#!/bin/sh -e -fdmove -c 2 1 +#!/usr/bin/env execlineb +# mail-gpg-decrypt <mailfile - filter for mblaze mshow backtick -n x { mktemp } importas tmp x -ifte { rm -f ${tmp} } { rm -f ${tmp} } +ifte { if { rm -rf ${tmp} } exit 64 } + { if { rm -rf ${tmp} } exit 0 } -backtick -n x { - pipeline { tee ${tmp} } - awk -F: " - /: application\/pgp-encrypted/ { supported = 1; } - /: application\/octet-stream/ { if (supported) print $1; } - " +importas type PIPE_CONTENTTYPE + +if { + redirfd -w 1 ${tmp} + if { echo Content-Type: ${type} } + if { echo } + cat } -importas n x -ifelse { test ${n} } { - pipeline { mshow -O ${tmp} ${n} } - gpg -d - exit 64 +backtick -n x { + pipeline { mshow -t ${tmp} } + sed -rn "s,^ *([0-9]+): application/octet-stream.*,\\1, p" } +importas n x -exit 0 +if { test ${n} } +pipeline { mshow -O ${tmp} ${n} } +gpg -d --skip-verify diff --git a/bin/mail-gpg-verify b/bin/mail-gpg-verify @@ -0,0 +1,21 @@ +#!/usr/bin/env execlineb +# mail-gpg-decrypt <mailfile - filter for mblaze mshow + +backtick -n x { mktemp } +importas tmp x + +ifte { if { rm -rf ${tmp} } exit 64 } + { if { rm -rf ${tmp} } exit 63 } + +if { redirfd -w 1 ${tmp} cat } + +backtick -n x { + pipeline { mshow -t ${tmp} } + sed -rn "s,.*([0-9]+): application/octet-stream .*,\\1, p" +} +importas n x + +if -t { test ${n} } + +pipeline { mshow -O ${tmp} ${n} } +gpg -d diff --git a/dot/mblaze/filter b/dot/mblaze/filter @@ -1 +1 @@ -application/pgp-encrypted: mail-gpg-decrypt +multipart/encrypted: mail-gpg-decrypt