Update mutt config
This commit is contained in:
33
mutt/filter.py
Executable file
33
mutt/filter.py
Executable 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)
|
||||
Reference in New Issue
Block a user