From 824310ee8ec5b825e0339b5592cf3eacf7cf577b Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Mon, 25 Nov 2019 16:49:24 +1300 Subject: [PATCH 01/16] make sidebar settings sourcing dependent on patch existence --- .mutt/muttrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.mutt/muttrc b/.mutt/muttrc index 5ef2b95..90bd690 100644 --- a/.mutt/muttrc +++ b/.mutt/muttrc @@ -13,7 +13,6 @@ source $my_confdir/keybindings source $my_confdir/lists source $my_confdir/spam source $my_confdir/hooks -source $my_confdir/sidebar auto_view text/html text/calendar #auto_view application/x-gunzip application/x-tar-gz application/x-tar application/x-gtar @@ -31,3 +30,7 @@ source "test -f $my_mutt_mailboxes && cat $my_mutt_mailboxes|" source "test -f $alias_file && cat $alias_file 2>/dev/null || echo unset alias_file|" source "mutt -DF/dev/null | grep -q send_multipart_alternative && cat $my_confdir/multipart-alternative|" + +# only source sidebar settings if the sidebar patch exist, i.e. default is +# non-zero +source "test -z $sidebar_visible || cat $my_confdir/sidebar|" -- 2.39.5 From 404a4537df5dd9e1b2522b7d0b0dc480577a6ec3 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Mon, 25 Nov 2019 16:49:41 +1300 Subject: [PATCH 02/16] make mp-alternative settings sourcing dependent on patch existence --- .mutt/muttrc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.mutt/muttrc b/.mutt/muttrc index 90bd690..0170c22 100644 --- a/.mutt/muttrc +++ b/.mutt/muttrc @@ -29,8 +29,10 @@ source "test -f $my_mutt_mailboxes && cat $my_mutt_mailboxes|" source "test -f $alias_file && cat $alias_file 2>/dev/null || echo unset alias_file|" -source "mutt -DF/dev/null | grep -q send_multipart_alternative && cat $my_confdir/multipart-alternative|" - # only source sidebar settings if the sidebar patch exist, i.e. default is # non-zero source "test -z $sidebar_visible || cat $my_confdir/sidebar|" + +# only source multipart/alternative settings if the multipart/alternative +# patch exist, i.e. default is non-zero +source "test -z $send_multipart_alternative || cat $my_confdir/multipart-alternative|" -- 2.39.5 From 74bc871ae581b7331e5254b267be881410ded994 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Mon, 25 Nov 2019 16:49:53 +1300 Subject: [PATCH 03/16] fail gracefully in absence of offlineimap mailboxes file --- .mutt/muttrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mutt/muttrc b/.mutt/muttrc index 0170c22..84f4311 100644 --- a/.mutt/muttrc +++ b/.mutt/muttrc @@ -25,7 +25,7 @@ mime_lookup application/octet-stream mailto_allow cc in-reply-to references subject body set my_mutt_mailboxes = "$VARDIR/mutt/mailboxes" -source "test -f $my_mutt_mailboxes && cat $my_mutt_mailboxes|" +source "test ! -f $my_mutt_mailboxes || cat $my_mutt_mailboxes|" source "test -f $alias_file && cat $alias_file 2>/dev/null || echo unset alias_file|" -- 2.39.5 From 92ca7dd4d572d8381b04999e60104599f3961a89 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 26 Nov 2019 15:43:04 +1300 Subject: [PATCH 04/16] disable opportunistic encrption --- .mutt/confvars | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mutt/confvars b/.mutt/confvars index d3096b4..fe67e65 100644 --- a/.mutt/confvars +++ b/.mutt/confvars @@ -682,7 +682,7 @@ set crypt_autosmime=no # this option will be disabled for that message. It can be manually re-enabled in # the pgp or smime menus. (Crypto only) # -set crypt_opportunistic_encrypt=yes +set crypt_opportunistic_encrypt=no # 3.47. crypt_replyencrypt -- 2.39.5 From 113bf527a5d265377259044538472308ca8ef69a Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 26 Nov 2019 15:43:13 +1300 Subject: [PATCH 05/16] unify context lines --- .mutt/confvars | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.mutt/confvars b/.mutt/confvars index fe67e65..e18f309 100644 --- a/.mutt/confvars +++ b/.mutt/confvars @@ -2149,7 +2149,7 @@ set mbox_type=Maildir # This variable controls the number of lines of context that are given when # scrolling through menus. (Similar to $pager_context.) # -set menu_context=2 +set menu_context=5 # 3.150. menu_move_off @@ -2487,7 +2487,7 @@ set pager_format="<%a> %* %i (%P)" # less than $pager_index_lines, then the index will only use as many lines as it # needs. # -set pager_index_lines=5 +set pager_index_lines=$menu_context # 3.176. pager_stop -- 2.39.5 From 3031cacf7cdae16c8ac58ca399675b22ab3ea0d9 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Thu, 5 Dec 2019 10:56:49 +0100 Subject: [PATCH 06/16] generalise the X-Bcc-* fields --- .mutt/sendmail | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.mutt/sendmail b/.mutt/sendmail index 635ff3e..881935d 100755 --- a/.mutt/sendmail +++ b/.mutt/sendmail @@ -31,9 +31,17 @@ for i in "$@"; do done cat > $TMPFILE -recipients="$recipients $(formail -czx X-Bcc-Spool: < "$TMPFILE" | tr -d ',')" + +remove_headers= +if ! formail -czx "Resent-" < "$TMPFILE" | grep -q .; then + # only do this for original mails, not bounces + recipients="$recipients $(formail -czx "X-Bcc" < "$TMPFILE" | tr -d ',')" + remove_headers="$remove_headers -IX-Bcc" +fi args=$(for i in $recipients; do echo "--arg=$i"; done) run-parts --exit-on-error --umask=0077 --arg="$TMPFILE" $args -- "$CHECKSDIR" -formail -I X-Bcc-Spool: < "$TMPFILE" | eval $SENDMAIL "$sendmail_args" -- "$recipients" + +formail $remove_headers < "$TMPFILE" \ + | eval $SENDMAIL "$sendmail_args" -- "$recipients" cleanup -- 2.39.5 From 2f0b628b422e7a543878f73857ded199becbb972 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 10 Mar 2020 20:02:01 +0100 Subject: [PATCH 07/16] handle tnef attachments --- .gitignore.d/mutt | 3 ++- .mutt/confvars | 2 +- .mutt/tnef-extractor | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100755 .mutt/tnef-extractor diff --git a/.gitignore.d/mutt b/.gitignore.d/mutt index a6f0ff5..55ea528 100644 --- a/.gitignore.d/mutt +++ b/.gitignore.d/mutt @@ -1,7 +1,6 @@ * !/.crontab.d/mutt !/.gitignore.d/mutt -!/.lbdbrc !/.mutt/ack-recipients !/.mutt/alternates !/.mutt/append-header @@ -27,6 +26,7 @@ !/.mutt/mailcap.editing !/.mutt/mailcap.htmldump !/.mutt/mailcap.icalendar +!/.mutt/markdown2html !/.mutt/mkconf !/.mutt/multipart-alternative !/.mutt/muttrc @@ -46,6 +46,7 @@ !/.mutt/sidebar !/.mutt/spam !/.mutt/supersede-header +!/.mutt/tnef-extractor !/.mutt/viewmailattachments !/.var/mutt/.gitignore !/.var/mutt/header_cache/.gitignore diff --git a/.mutt/confvars b/.mutt/confvars index e18f309..d07933a 100644 --- a/.mutt/confvars +++ b/.mutt/confvars @@ -2018,7 +2018,7 @@ set mail_check_stats=yes # This variable specifies which files to consult when attempting to display MIME # bodies not directly supported by Mutt. # -set mailcap_path="$my_confdir/mailcap.icalendar:$my_confdir/mailcap.backgrounding:$my_confdir/mailcap.htmldump" +set mailcap_path="$my_confdir/mailcap.tnef:$my_confdir/mailcap.icalendar:$my_confdir/mailcap.backgrounding:$my_confdir/mailcap.htmldump" # 3.139. mailcap_sanitize diff --git a/.mutt/tnef-extractor b/.mutt/tnef-extractor new file mode 100755 index 0000000..d11d25f --- /dev/null +++ b/.mutt/tnef-extractor @@ -0,0 +1,41 @@ +#!/bin/sh +set -eu + +SELF="${0##*/}" + +if [ -z "${TMPDIR:-}" ]; then + TMPDIR=/tmp +fi +for i in $LOGNAME volatile; do + if [ -d "${TMPDIR}/$i" ]; then + TMPDIR="${TMPDIR}/$i" + break + fi +done +export TMPDIR +TMPDIR=$(mktemp -dp "$TMPDIR" tnef.XXXXXXXXXX) +cleanup() +{ + cd / && rm -r "$TMPDIR" + [ ! -t 0 ] || stty echo + trap - 0 1 2 3 4 5 6 7 8 10 11 12 13 14 15 +} +trap cleanup 0 1 2 3 4 5 6 7 8 10 11 12 13 14 15 + +cd "$TMPDIR" +tnef -v + +nfiles=$(ls -1 | wc -l) +if [ $nfiles -eq 1 ]; then + + set -x + setsid run-mailcap * & + PID=$! + ZSH_PREFILL_CMD="mv '$(echo -n *)' " x-terminal-emulator + perl -e "kill '-TERM', $PID" + +else + + ZSH_RUN_ON_LOAD="ls -l" x-terminal-emulator + +fi -- 2.39.5 From f043da5477d57171cfd6e8c319b47a70fd997294 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 10 Mar 2020 20:02:17 +0100 Subject: [PATCH 08/16] set $mbox to spool --- .mutt/confvars | 1 + 1 file changed, 1 insertion(+) diff --git a/.mutt/confvars b/.mutt/confvars index d07933a..e7d713b 100644 --- a/.mutt/confvars +++ b/.mutt/confvars @@ -2128,6 +2128,7 @@ set markers=no # # Also see the $move variable. # +set mbox="=spool" # 3.148. mbox_type -- 2.39.5 From 35dff95984713de562f2f5863aa2131bed841cca Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 10 Mar 2020 20:02:38 +0100 Subject: [PATCH 09/16] ical-parser: stringify an event label before printing --- .mutt/icalparser | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mutt/icalparser b/.mutt/icalparser index 77e7fe2..50ed472 100755 --- a/.mutt/icalparser +++ b/.mutt/icalparser @@ -52,7 +52,7 @@ def parse_ics_file(fp): event['flags'] = ' '.join('{}:{}'.format(*f) for f in flags) for label in FIELDS: if label in event: - text = fill(event[label], width=COLUMNS-INDENT, + text = fill(str(event[label]), width=COLUMNS-INDENT, initial_indent='', subsequent_indent=' '*INDENT) print(f'{label.capitalize():>{WIDTH}s}{COLSEP}{text}') -- 2.39.5 From 8ba8729fd14f583fa96f648738a36a70f26232be Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 10 Mar 2020 20:03:22 +0100 Subject: [PATCH 10/16] add openedu-parents list --- .mutt/lists | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.mutt/lists b/.mutt/lists index d1fcdec..c6d52f7 100644 --- a/.mutt/lists +++ b/.mutt/lists @@ -88,6 +88,8 @@ subscribe germany@lists.fsfe.org subscribe talk@lists.muc.ccc.de subscribe cryptography@metzdowd.com +subscribe openedu-parents@lists.openstem.com.au + subscribe vcs-home@lists.madduck.net subscribe webis-android-beta@googlegroups.com -- 2.39.5 From 500c8a72b950c790a40e525bb338fb98013f94f7 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 10 Mar 2020 20:04:19 +0100 Subject: [PATCH 11/16] md2html: reformat quotes --- .mutt/markdown2html | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.mutt/markdown2html b/.mutt/markdown2html index be705d6..d285814 100755 --- a/.mutt/markdown2html +++ b/.mutt/markdown2html @@ -48,18 +48,16 @@ except ImportError: DEFAULT_CSS += ''' -.quote { +.quote, blockquote { padding: 0 0.5em; margin: 0; font-style: italic; - border-left: 2px solid #ccc; - color: #999; + border-left: 2px solid #666; + color: #666; font-size: 80%; } .quotelead { - font-style: italic; margin-bottom: -1em; - color: #999; font-size: 80%; } .quotechar { display: none; } -- 2.39.5 From 3803d2cf1b594cc4d5001dea7a3c5b9dafaf0a2a Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 10 Mar 2020 20:04:33 +0100 Subject: [PATCH 12/16] md2html: style and size headers --- .mutt/markdown2html | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.mutt/markdown2html b/.mutt/markdown2html index d285814..d4f5b13 100755 --- a/.mutt/markdown2html +++ b/.mutt/markdown2html @@ -78,6 +78,18 @@ th, td { padding: 0.5em; } background: #eee; } .even { background: #eee; } +h1, h2, h3, h4, h5, h6 { + color: #666; + background-color: #eee; + padding-left: 0.5em +} +h1 { font-size: 130%; } +h2 { font-size: 120%; } +h3 { font-size: 110%; } +h4 { font-size: 107%; } +h5 { font-size: 103%; } +h6 { font-size: 100%; } +p { padding: 0 0.5em; } ''' STYLESHEET = os.path.join(os.path.expanduser('~/.mutt'), -- 2.39.5 From 6ebf19acd375963b83cfc7577440c17eda803548 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 10 Mar 2020 20:04:45 +0100 Subject: [PATCH 13/16] md2html: introduce block class --- .mutt/markdown2html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.mutt/markdown2html b/.mutt/markdown2html index d4f5b13..35b4ea2 100755 --- a/.mutt/markdown2html +++ b/.mutt/markdown2html @@ -48,6 +48,11 @@ except ImportError: DEFAULT_CSS += ''' +.block { + padding: 0 0.5em; + margin: 0; + border-left: 2px solid #eee; +} .quote, blockquote { padding: 0 0.5em; margin: 0; -- 2.39.5 From 45e0ac7684ad3e7992531506c5136e339c95cee4 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 10 Mar 2020 20:05:35 +0100 Subject: [PATCH 14/16] remove HTML-mail title --- .mutt/markdown2html | 1 - 1 file changed, 1 deletion(-) diff --git a/.mutt/markdown2html b/.mutt/markdown2html index 35b4ea2..72d0830 100755 --- a/.mutt/markdown2html +++ b/.mutt/markdown2html @@ -107,7 +107,6 @@ HTML_DOCUMENT = ''' -HTML E-Mail {htmlbody} ''' -- 2.39.5 From bdc72aa08e45f6ae73c31b502321fcb157a280f7 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 10 Mar 2020 20:06:15 +0100 Subject: [PATCH 15/16] md2html generate standalone emails (include images) --- .mutt/markdown2html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.mutt/markdown2html b/.mutt/markdown2html index 72d0830..4bb1a9d 100755 --- a/.mutt/markdown2html +++ b/.mutt/markdown2html @@ -214,7 +214,7 @@ def _reformat_quotes(html): def _convert_with_pandoc(mdwn, inputfmt='markdown', outputfmt='html5', ext_enabled=None, ext_disabled=None, - standalone=True, title="HTML E-Mail"): + standalone=True, selfcontained=True, title="HTML E-Mail"): ''' Invoke pandoc to do the actual conversion of Markdown to HTML5. ''' @@ -257,6 +257,8 @@ def _convert_with_pandoc(mdwn, inputfmt='markdown', outputfmt='html5', args = [] if standalone: args.append('--standalone') + if selfcontained: + args.append('--self-contained') if title: args.append(f'--metadata=pagetitle:"{title}"') @@ -294,7 +296,7 @@ def convert_markdown_to_html(mdwn): if body: body = _preprocess_markdown(body) body = _identify_quotes_for_later(body) - html = _convert_with_pandoc(body, standalone=False) + html = _convert_with_pandoc(body, standalone=True, selfcontained=True) html = _reformat_quotes(html) if sig: -- 2.39.5 From db13fabef4016b65602264e263ac23ae332ec660 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 10 Mar 2020 20:06:46 +0100 Subject: [PATCH 16/16] sendmail: single-line recipients list --- .mutt/sendmail | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.mutt/sendmail b/.mutt/sendmail index 881935d..b125941 100755 --- a/.mutt/sendmail +++ b/.mutt/sendmail @@ -41,6 +41,8 @@ fi args=$(for i in $recipients; do echo "--arg=$i"; done) run-parts --exit-on-error --umask=0077 --arg="$TMPFILE" $args -- "$CHECKSDIR" +recipients=$(echo "$recipients" | xargs) + formail $remove_headers < "$TMPFILE" \ | eval $SENDMAIL "$sendmail_args" -- "$recipients" -- 2.39.5