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:
@@ -42,20 +42,30 @@ in rec {
|
|||||||
${pkgs.coreutils}/bin/printf '%s\n' 'nameserver 1.1.1.1' 'options edns0' > /etc/resolv.conf
|
${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";
|
name = "much-scripts";
|
||||||
paths = [
|
paths = [ mail-send much-current-query mail-reply mail-kill ];
|
||||||
(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 ];
|
|
||||||
})
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
showkeys-toggle = pkgs.writers.writeDashBin "showkeys-toggle" ''
|
showkeys-toggle = pkgs.writers.writeDashBin "showkeys-toggle" ''
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
set -efu
|
set -efu
|
||||||
|
|
||||||
reply_to=$(mail-current-query)
|
reply_to=$(much-current-query)
|
||||||
|
|
||||||
if ! test "$(notmuch search --output=messages "$reply_to" | wc -l)" = 1; then
|
if ! test "$(notmuch search --output=messages "$reply_to" | wc -l)" = 1; then
|
||||||
echo "current query doesn't point to exactly one message. abort." >&2
|
echo "current query doesn't point to exactly one message. abort." >&2
|
||||||
@@ -41,8 +41,7 @@ mail=$(
|
|||||||
|
|
||||||
printf %s "$mail" | msmtpq --read-recipients --read-envelope-from
|
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 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
|
if test "$(notmuch search --output=messages "id:$in_reply_to")" != "id:$in_reply_to"; then
|
||||||
|
|||||||
Reference in New Issue
Block a user