summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaromil <jaromil@dyne.org>2017-04-18 08:21:22 (GMT)
committer Jaromil <jaromil@dyne.org>2017-04-18 08:21:22 (GMT)
commitc66146b6276c2b31937a28228167126aa3a08529 (patch)
tree3ff1498b1443dd6ba7ae08d4b80d3f2c60f1715c
parentd012394e9cf139c99029341f7b2894458708e354 (diff)
custom headers configured per-account
-rwxr-xr-xsrc/jaro3
-rwxr-xr-xsrc/zlibs/accounts4
-rwxr-xr-xsrc/zlibs/mutt18
3 files changed, 25 insertions, 0 deletions
diff --git a/src/jaro b/src/jaro
index 453148a..4530949 100755
--- a/src/jaro
+++ b/src/jaro
@@ -136,6 +136,7 @@ list=whitelist
vars+=(name login imap imap_port smtp smtp_port protocol password auth accountopt)
arrs+=(folders exclude)
vars+=(host port type)
+vars+=(my_hdr)
# global for server fingerprints
vars+=(fingerprint)
@@ -850,6 +851,7 @@ EOF
__empty) # unknown command, pass it to autostart
func "no command, autostart"
func "subcommand: $subcommand"
+ read_account "$account"
if [[ "$subcommand" = "__empty" ]]; then
# open folder
if [[ "$option_params" = "" ]]; then
@@ -865,6 +867,7 @@ EOF
# argument passed: determine if an email
subcommand=${subcommand[(ws@:@)2]}
func "subcommand: $subcommand"
+ read_account "$account"
if isemail "$subcommand"; then
notice "Composing message to: $*"
# its an email, TODO see if we have it in our addressbook
diff --git a/src/zlibs/accounts b/src/zlibs/accounts
index 3e73454..b6abc9e 100755
--- a/src/zlibs/accounts
+++ b/src/zlibs/accounts
@@ -97,6 +97,7 @@ read_account() {
}
ttmp=`awk '
+ /^my_hdr/ { next }
/^#/ { next }
/^name/ { printf "name=\""; for(i=2;i<=NF;i++) printf "%s ", $i; printf "\";" }
/^email/ { printf "email=\"%s\";", $2 }
@@ -167,6 +168,9 @@ read_account() {
func "options: $accountopt"
func "folders: $folders"
func "exclude: $exclude"
+ my_hdr=`cat "$acct" | grep '^my_hdr'`
+ [[ "$my_hdr" = "" ]] ||
+ func "my_hdr:\n$my_hdr"
return 0
}
diff --git a/src/zlibs/mutt b/src/zlibs/mutt
index 1ca3077..c78b4e5 100755
--- a/src/zlibs/mutt
+++ b/src/zlibs/mutt
@@ -97,7 +97,10 @@ source '$WORKDIR/.mutt/general'
source '$WORKDIR/.mutt/formats'
source '$WORKDIR/.mutt/keybindings'
source '$WORKDIR/.mutt/colors'
+
+# identity built parsing accounts and global file
source '$MAILDIRS/Identity.txt'
+source '$MAILDIRS/.mutt/identity'
# pointer to password tempfile and dynamic settings
# must be before mboxes to set folder on imap peek
@@ -113,6 +116,21 @@ source '$MAILDIRS/.mutt/notmuch'
source '$MAILDIRS/.mutt/crypto'
EOF
+ # identity
+ rm -f "$MAILDIRS/.mutt/identity"
+ touch "$MAILDIRS/.mutt/identity"
+ cat <<EOF > $MAILDIRS/.mutt/identity
+set realname = '$name'
+set from = '${name} <${email}>'
+EOF
+ [[ "$gpgkey" = "" ]] ||
+ print "set pgp_sign_as = '${gpgkey}'" >> $MAILDIRS/.mutt/identity
+ [[ -r ~/.signature ]] &&
+ print "set signature = '~/.signature'" >> $MAILDIRS/.mutt/identity
+ [[ "$my_hdr" = "" ]] ||
+ print "$my_hdr" >> $MAILDIRS/.mutt/identity
+
+
rm -f "$MAILDIRS/.mutt/crypto"
touch "$MAILDIRS/.mutt/crypto"
# support opmux or fallback to gpgewrap