1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

feat(scripts): mail-reply, much-current-query

This commit is contained in:
2021-03-03 19:03:59 +01:00
parent 5dccdfee83
commit 12698d9f48
4 changed files with 25 additions and 16 deletions

View File

@@ -42,20 +42,30 @@ in rec {
${pkgs.coreutils}/bin/printf '%s\n' 'nameserver 1.1.1.1' 'options edns0' > /etc/resolv.conf
'';
much-scripts = pkgs.symlinkJoin {
much-scripts = let
much-current-query = wrapScript {
packages = [ pkgs.curl ];
name = "much-current-query";
script = ./much-current-query.sh;
};
mail-send = wrapScript {
packages = [ pkgs.notmuch pkgs.msmtp pkgs.jq ];
name = "mail-send";
script = ./mail-send.sh;
};
mail-reply = wrapScript {
packages = [ much-current-query pkgs.notmuch pkgs.gnused pkgs.jq ];
name = "mail-reply";
script = ./mail-reply.sh;
};
mail-kill = wrapScript {
name = "mail-kill";
script = ./mail-kill.sh;
packages = [ pkgs.notmuch ];
};
in pkgs.symlinkJoin {
name = "much-scripts";
paths = [
(wrapScript {
packages = [ pkgs.notmuch pkgs.msmtp pkgs.jq ];
name = "mail-send";
script = ./mail-send.sh;
})
(wrapScript {
name = "mail-kill";
script = ./mail-kill.sh;
packages = [ pkgs.notmuch ];
})
];
paths = [ mail-send much-current-query mail-reply mail-kill ];
};
showkeys-toggle = pkgs.writers.writeDashBin "showkeys-toggle" ''

View File

@@ -1,7 +1,7 @@
#! /bin/sh
set -efu
reply_to=$(mail-current-query)
reply_to=$(much-current-query)
if ! test "$(notmuch search --output=messages "$reply_to" | wc -l)" = 1; then
echo "current query doesn't point to exactly one message. abort." >&2

View File

@@ -41,8 +41,7 @@ mail=$(
printf %s "$mail" | msmtpq --read-recipients --read-envelope-from
# insertion is done upstream (by gmail, posteo, and the like)
# printf %s "$mail" | notmuch insert
printf %s "$mail" | notmuch insert
if in_reply_to=$(printf %s "$mail" | get_in_reply_to); then
if test "$(notmuch search --output=messages "id:$in_reply_to")" != "id:$in_reply_to"; then