Started some much needed updating of the fleacollar code. Likely not usable yet.

This commit is contained in:
Storm Dragon
2025-04-09 20:46:38 -04:00
parent 1d609e46d3
commit 4183969b68
10 changed files with 331 additions and 294 deletions

49
files/add_address.sh Normal file
View File

@ -0,0 +1,49 @@
#!/usr/bin/env bash
add_email() {
local alias="<${newAlias% *}"
local emailAddress="<${newAlias##*<}"
local ignoreList=(
'amazon.com'
'billing@'
'do-not-reply'
'donotreply'
'github.com'
'gitlab.com'
'mailto'
'no-reply'
'noreply'
'paypal.com'
'walmart.com'
)
# Make the list into a format that works with bash regexp.
ignoreList="${ignoreList[*]}"
ignoreList="${ignoreList// /|}"
# Do not add aliases with no alias-name
if [[ "$alias" == "UNNAMED" ]]; then
return
fi
# Try to filter out addresses that do not receive replies.
if [[ "${emailAddress,,}" =~ ${ignoreList} ]]; then
return
fi
# Do not add the same address twice.
if grep -Fq "$emailAddress" $HOME/.mutt/aliases ; then
return
fi
# Try to not use the same alias-name
if grep -Fq " $alias " $HOME/.mutt/aliases; then
alias="${alias}-${emailAddress#*@}"
alias="${alias%.*}"
fi
if grep -Fq "$alias" $HOME/.mutt/aliases; then
return
fi
echo "$newAlias" >> $HOME/.mutt/aliases
sort -u ~/.mutt/aliases -o ~/.mutt/aliases
}
message=$(cat)
newAlias=$(echo "${message}" | grep ^"From: " | sed -e s/[\,\"\']//g -e s/'From: '//g | awk -F" " '{if (NF == 1) {print "alias UNNAMED UNNAMED " $0;} else if (NF == 2) {print "alias " $1" " toupper(substr($0,1,1)) tolower(substr($0,2));} else if (NF >= 3) {print "alias ", tolower($1)"-"tolower($(NF-1))" " toupper(substr($0,1,1)) tolower(substr($0,2));}}')
add_email
echo "${message}"

10
files/generic.template Normal file
View File

@ -0,0 +1,10 @@
unset imap_passive
unset record
set smtp_url="smtp://SMTP_USER@SMTP_HOST:SMTP_PORT/
set folder=imaps://IMAP_USER@IMAP_HOST:IMAP_PORT/
mailboxes = +INBOX
set spoolfile = +INBOX
set postponed = +Drafts
set imap_keepalive=300
set mail_check=300
bind editor <Tab> complete-query

11
files/gmail.template Normal file
View File

@ -0,0 +1,11 @@
unset imap_passive
unset record
set imap_user=EMAIL_ADDRESS
set smtp_url="smtp://USERNAME@smtp.gmail.com:587/
set folder=imaps://USERNAME@imap.gmail.com/
set spoolfile = +INBOX
mailboxes = +INBOX
set postponed = +[Gmail]/Drafts
set record=+[Gmail]/Sent
set imap_keepalive=300
set mail_check=300

3
files/gpg-agent.conf Normal file
View File

@ -0,0 +1,3 @@
default-cache-ttl 300
max-cache-ttl 999999
allow-loopback-pinentry

12
files/gpg.conf Normal file
View File

@ -0,0 +1,12 @@
charset utf-8
require-cross-certification
no-escape-from-lines
no-mangle-dos-filenames
personal-digest-preferences SHA512
cert-digest-algo SHA512
use-agent
default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed
keyserver wwwkeys.pgp.net
keyserver hkp://pool.sks-keyservers.net
keyserver pgp.zdv.uni-mainz.de
keyserver-options auto-key-retrieve

13
files/hotmail.template Normal file
View File

@ -0,0 +1,13 @@
unset imap_passive
unset record
set imap_user=EMAIL_ADDRESS
set smtp_url="smtp://EMAIL_ADDRESS@smtp-mail.outlook.com:587/
set folder=imaps://EMAIL_ADDRESS@imap-mail.outlook.com/
set ssl_force_tls=yes
set spoolfile=+Inbox
mailboxes = +Inbox
set postponed=+Drafts
set record=+Sent
set imap_keepalive=300
set mail_check=300
bind editor <Tab> complete-query

7
files/macros Normal file
View File

@ -0,0 +1,7 @@
macro index 'c' '<change-folder>?<change-dir><home>^K=<enter>'
bind index "^" imap-fetch-mail"
macro pager \cb <pipe-entry>'urlview'<enter> 'Follow links with urlview'
macro attach 'B' "<pipe-entry>cat >~/.cache/mutt/mail.html && $BROWSER ~/.cache/"
macro index,pager b '<enter-command>source $muttHome/aliases<enter><bounce-message>'
macro index,pager f '<enter-command>source $muttHome/aliases<enter><forward-message>'
macro index,pager m '<enter-command>source $muttHome/aliases<enter><mail>'

12
files/mailcap Normal file
View File

@ -0,0 +1,12 @@
text/html; w3m -s -o display_link=yes -o display_link_number=yes -o decode_url=yes -dump -T text/html %s -I %{charset};nametemplate=%s.html;copiousoutput
audio/*; mpv --quiet %s; needsterminal
application/msword; soffice --cat %s 2> /dev/null; copiousoutput
application/vnd.openxmlformats-officedocument.wordprocessingml.document; soffice --cat %s 2> /dev/null; copiousoutput
application/vnd.ms-excel; xls2csv %s; copiousoutput
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; xlsx2csv --all %s; copiousoutput
application/rtf; soffice --cat %s 2> /dev/null; copiousoutput
application/vnd.oasis.opendocument.text; soffice --cat %s 2> /dev/null; copiousoutput
application/vnd.oasis.opendocument.spreadsheet;soffice --cat --convert-to csv:"Text - txt - csv (StarCalc)":"59,ANSI,1" %s 2> /dev/null; copiousoutput
application/pdf; pdftotext %s -; copiousoutput
video/*; mpv --quiet %s; test=test -n "$DISPLAY"; needsterminal
video/*; mpv --quiet --no-video %s; needsterminal

27
files/muttrc Normal file
View File

@ -0,0 +1,27 @@
set text_flowed = yes
set index_format = '[%Z] %-20.20F %s (Attached %X, Msg %4C)'
set send_charset = us-ascii:utf-8
set pager = 'builtin'
set pager_stop = 'yes'
set sort = threads
set beep_new = yes
set display_filter = '$muttHome/scripts/add_address.sh'
set print = yes
set imap_check_subscribed = yes
set sort_alias = alias
set reverse_alias = yes
set alias_file = ${muttHome/#$HOME/\~}/aliases
source ${muttHome/#$HOME/\~}/aliases
set history_file = ${muttHome/#$HOME/\~}/history
set history = 1024
set mailcap_path = ${muttHome/#$HOME/\~}/mailcap
set header_cache = ${muttHome/#$HOME/\~}/cache/headers
set message_cachedir = ${muttHome/#$HOME/\~}/cache/bodies
set certificate_file = ${muttHome/#$HOME/\~}/certificates
set markers = no
unset mark_old
auto_view text/html
alternative_order text/plain text/enriched text/html
message-hook '!(~g|~G) ~b\"^ 5 dash charactersBEGIN\\ PGP\\ (SIGNED\\ )?MESSAGE\"' "exec check-traditional-pgp"
source ${muttHome/#$HOME/\~}/gpg.rc
source ${muttHome/#$HOME/\~}/macros