commit ddc7d3cc753e70331f4c0d8327851913ccbe859f
parent 7ca71acba35012f303e8ed5266d6e111a6773aff
Author: Christoph Lohmann <20h@r-36.net>
Date: Wed, 26 Nov 2014 20:36:48 +0100
Syncing the templates.
1.) Add a Content-Transfer-Encoding, which is needed for certain MUAs.
2.) Add support for custom mail headers in compose.
3.) Add suport for the new URI syntax in view and scan.
4.)
Diffstat:
6 files changed, 30 insertions(+), 37 deletions(-)
diff --git a/tmpl/compose.sh b/tmpl/compose.sh
@@ -15,14 +15,10 @@ Bcc:
User-Agent: rohrpost
MIME-Version: 1.0
Content-Type: text/plain; charset=\"utf-8\"
-Content-Transfer-Encoding: 8bit
-
-Text\n" "$(LANG=C date "+%a, %d %b %Y %T %z")" \
+Content-Transfer-Encoding: 8bit\n" "$(LANG=C date "+%a, %d %b %Y %T %z")" \
"$(rpcfg -v defaultfrom)" \
"${to}"
-
-if [ -e $HOME/.signature ];
-then
- cat $HOME/.signature
-fi
+[ -e "$HOME/.mailheaders" ] && cat "$HOME/.mailheaders"
+printf "\nText\n"
+[ -e $HOME/.signature ] && cat $HOME/.signature
diff --git a/tmpl/fwd.sh b/tmpl/fwd.sh
@@ -43,12 +43,17 @@ Bcc:
User-Agent: rohrpost
MIME-Version: 1.0
Content-Type: text/plain; charset=\"utf-8\"
-Content-Transfer-Encoding: 8bit\n" \
+Content-Transfer-Encoding: 8bit" \
"$(LANG=C date "+%a, %d %b %Y %T %z")" \
"$(rpcfg -v defaultfrom)" \
"${nsubject}"
+[ -e "$HOME/.mailheaders" ] && cat "$HOME/.mailheaders"
+printf "\n"
# Consider checking for multiple messages and add them as eml or inline.
rpview -nb -- "$ids" | sed 's/^/> /'
printf "\n"
+[ -e "$HOME/.signature" ] && cat "$HOME/.signature"
+
+
diff --git a/tmpl/news.sh b/tmpl/news.sh
@@ -8,21 +8,11 @@ subjectformat="$reset"
first=1
-cfgname="$(rpcfg -n)"
-if [ "$cfgname" = "default" ];
-then
- # shorten the URI
- cfgname=""
-fi
-
-mailboxname="$(rpsel)"
-baseuri="rpo:/${cfgname}/${mailboxname}/"
-
cols=$(tput cols)
while read -r line;
do
- id=$(echo -n "$line" | cut -f 1 | head -c 8)
+ id=$(echo -n "$line" | cut -f 1)
date=$(echo -n "$line" | cut -f 2 | head -c 10)
subject=$(echo -n "$line" | cut -f 4)
@@ -34,8 +24,8 @@ do
else
ostr="$(printf "${dateformat}%10s${reset}" "$date")"
flen=$(($(utf8expr length "$date") + 2))
- ostr="${ostr} $(printf "${idformat}%s${reset}" "${baseuri}$id")"
- flen=$(($flen + $(utf8expr length "${baseuri}$id") + 2))
+ ostr="${ostr} $(printf "${idformat}%s${reset}" "$id")"
+ flen=$(($flen + $(utf8expr length "$id") + 2))
scols=$(($cols - $flen))
printf "%s " "${ostr}"
diff --git a/tmpl/repl.sh b/tmpl/repl.sh
@@ -148,14 +148,12 @@ printf "To: ${nto}\n"
printf "Cc: ${ncc}\n"
printf "Bcc:\n"
printf "Subject: ${nsubject}\n"
+[ -e "$HOME/.mailheaders" ] && cat "$HOME/.mailheaders"
printf "\n"
printf "On $(LANG=C date "+%a, %d %b %Y %T %z") ${from} wrote:\n"
rpview -nb -- "$ids" | sed 's/^/> /'
printf "\n"
-if [ -e $HOME/.signature ];
-then
- cat $HOME/.signature
-fi
+[ -e $HOME/.signature ] && cat $HOME/.signature
diff --git a/tmpl/scan.sh b/tmpl/scan.sh
@@ -7,28 +7,32 @@ dateformat="$(tput setaf 3)"
fromformat="$(tput setaf 7)"
subjectformat="$reset"
-flen=40
-cols=$(tput cols)
-scols=$(($cols - $flen))
-
first=1
+cols=$(tput cols)
+
while read -r line;
do
- id=$(echo -n "$line" | cut -f 1 | head -c 8)
+ id=$(echo -n "$line" | cut -f 1)
date=$(echo -n "$line" | cut -f 2 | head -c 16)
from=$(utf8expr substr "$(echo -n "$line" | cut -f 3)" 1 10)
subject=$(echo -n "$line" | cut -f 4)
if [ $first -eq 1 ];
then
- printf "${titleformat}%8s %16s %10s %s\n" "$id" "$date" \
- "$from" "$subject"
+ #printf "${titleformat}%8s %16s %10s %s\n" "$id" "$date" \
+ # "$from" "$subject"
first=0
else
- printf "${idformat}%8s${reset} " "$id"
- printf "${dateformat}%16s${reset} " "$date"
- printf "${fromfromat}%10s${reset} " "$from"
+ ostr="$(printf "${dateformat}%10s${reset}" "$date")"
+ flen=$(($(utf8expr length "$date") + 2))
+ ostr="${ostr} $(printf "${fromformat}%10s${reset}" "$from")"
+ flen=$(($flen + 10 + 2))
+ ostr="${ostr} $(printf "${idformat}%s${reset}" "$id")"
+ flen=$(($flen + $(utf8expr length "$id") + 2))
+ scols=$(($cols - $flen))
+
+ printf "%s " "${ostr}"
slen=$(utf8expr length "$subject")
if [ $scols -lt 1 ] || [ $scols -gt $slen ];
then
diff --git a/tmpl/view.sh b/tmpl/view.sh
@@ -63,7 +63,7 @@ do
case $state in
id)
- te=$(echo -n "$line" | grep "^--")
+ te=$(echo -n "$line" | grep "^---")
if [ -n "$te" ];
then
printf "${idformat}%s${reset}\n" "$line"