imprv: reply

This commit is contained in:
2026-03-17 14:25:03 +01:00
parent ce9f16e293
commit aa25dc2530
4 changed files with 16 additions and 20 deletions

View File

@@ -254,7 +254,7 @@ if [ "${1:-}" = "--show-thread" ]; then
--bind="$KEYS_OPEN:execute:$0 --open-part {5}" \
--bind="$KEYS_FLAG:execute($0 --flag message {+5})+reload:$0 --list-messages-in-thread \"$thread\"" \
--bind="$KEYS_UNFLAG:execute($0 --unflag message {+5})+reload:$0 --list-messages-in-thread \"$thread\"" \
--bind="$KEYS_REPLY:execute:$0 --reply {5}" \
--bind="$KEYS_REPLY:execute:$0 --reply message {5}" \
--bind="$KEYS_VIEW_LOGS:execute:$0 --view-logs" \
--bind="$KEYS_COMPOSE:execute:$0 --compose" \
--bind="focus:change-preview($0 --preview-message {5})+transform-footer:printf '\033[4mMesssage parts\033[0m\n';$0 --show-message-parts {5}" \
@@ -309,6 +309,7 @@ if [ "${1:-}" = "--compose" ]; then
echo "From: $PRIMARY_NAME <$PRIMARY_EMAIL>"
echo "To: $address"
echo "Cc: "
[ "$BCC_TO_SELF" ] && echo "Bcc: $PRIMARY_NAME <$PRIMARY_EMAIL>"
echo "Subject: "
echo ""
echo "Message body goes here"
@@ -322,9 +323,16 @@ fi
if [ "${1:-}" = "--reply" ]; then
shift
messageid="$1"
[ "$1" = "thread" ] && thread=1
shift
[ ! "${thread:-}" ] && messageid="$1" || messageid="$(nm_last_message_in_thread "$1")"
tmpfile=$(mktemp --suffix='.eml')
$NOTMUCH reply id:"$messageid" > "$tmpfile"
if [ "$BCC_TO_SELF" ]; then
$NOTMUCH reply id:"$messageid" |
awk '!f && /^From:/ { print "Bcc: "substr($0, 7); f=1 } {print}' > "$tmpfile"
else
$NOTMUCH reply id:"$messageid" > "$tmpfile"
fi
$EDITOR "$tmpfile"
# Confirm and send
send "$tmpfile"
@@ -342,6 +350,7 @@ if [ "${1:-}" = "--send-test-email" ]; then
{
echo "From: $PRIMARY_NAME <$PRIMARY_EMAIL>"
echo "To: $PRIMARY_NAME <$PRIMARY_EMAIL>"
[ "$BCC_TO_SELF" ] && echo "Bcc: $PRIMARY_NAME <$PRIMARY_EMAIL>"
echo "Subject: Test E-Mail from $APP_NAME version $APP_VERSION"
echo ""
echo "This is a test email sent from from [$APP_NAME]($APP_WEBSITE)."
@@ -429,6 +438,7 @@ while true; do
--bind="$KEYS_SEARCH_UNREAD:print($CMD_GOTO_UNREAD)+accept" \
--bind="$KEYS_SEARCH_FLAGGED:print($CMD_GOTO_FLAGGED)+accept" \
--bind="$KEYS_VIEW_LOGS:execute:$0 --view-logs" \
--bind="$KEYS_REPLY:execute:$0 --reply thread {4}" \
--bind="$KEYS_SYNC:execute($0 --sync)+reload:$0 --list-threads \"$nmquery\"" \
--bind="$KEYS_COMPOSE:execute:$0 --compose" \
--bind="$KEYS_GOTO_FIRST:first" \