Update mutt config

This commit is contained in:
2022-10-11 08:30:13 +02:00
parent b07e3c902f
commit ce0180d283
2 changed files with 90 additions and 40 deletions

33
mutt/filter.py Executable file
View File

@@ -0,0 +1,33 @@
#!/usr/bin/env python3
import re
import sys
# Read data from stdin
data = sys.stdin.read()
# Remove unwanted text
data = re.sub(r'\[-- Autoview.*--\]', '', data)
data = re.sub(r'\[-- Attachment #[0-9] --\]', '', data)
data = re.sub(r'\[cid\]', '', data)
data = re.sub(r'\[-- application.*unsupported.*--\]', '', data)
data = re.sub(r'\[-- image.*unsupported.*--\]', '', data)
data = re.sub(r'\[-- Type.*--\]', '', data)
# replace text for signed and encrypted email
data = re.sub(r'\[-- OpenSSL.*\nVerification successful\n.*',
'[-- Signed Email: Verification successful --]', data)
data = re.sub(r'\[-- The following data is S/MIME encrypted --\]',
'[-- Encrypted Email: S/MIME --]', data)
data = re.sub(r'\[-- The following data is signed --\]', '', data)
data = re.sub(r'\[-- End of signed data --\]', '', data)
data = re.sub(r'\[-- End of S/MIME encrypted data. --\]', '', data)
# Add line for quoted email
data = re.sub(r'(?<=\n)(From:.*)', '_'*80 + r'\n\1', data)
# clean up multiple blanks lines
data = re.sub(r'.*\n', '', data)
data = re.sub(r'\n\s*\n', r'\n\n', data)
# Output filtered text to stdout
sys.stdout.write(data)