소스 검색

simplification of decoding, show help on noopt

pull/913/head
Luke Smith 1 년 전
부모
커밋
d3300a478d
No known key found for this signature in database GPG 키 ID: 4C50B54A911F6252
2개의 변경된 파일8개의 추가작업 그리고 10개의 파일을 삭제
  1. +6
    -10
      bin/mailsync
  2. +2
    -0
      bin/mw

+ 6
- 10
bin/mailsync 파일 보기

@@ -70,16 +70,12 @@ syncandnotify() {
echo "$newcount new mail for $2."
[ -z "$MAILSYNC_MUTE" ] &&
for file in $new; do
# Extract subject and sender from mail. TODO: beautify and clean up.
from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" |
perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' |
awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' |
sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//')
subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" |
head -n 1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' |
sed 's/^Subject: //' |
sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' |
tr -d '\n')
# Extract and decode subject and sender from mail.
subject="$(sed -n "/^Subject:/ s|Subject: *|| p" "$file" |
perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')"
from="$(sed -n "/^From:/ s|From: *|| p" "$file" |
perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')"
from="${from% *}" ; from="${from%\"}" ; from="${from#\"}"
notify "📧$from:" "$subject"
done
;;


+ 2
- 0
bin/mw 파일 보기

@@ -313,6 +313,8 @@ while getopts "rfpXlhodTYD:y:i:I:s:S:u:a:n:P:x:m:t:" o; do case "${o}" in
\?) echo "See \`$(basename $0) -h\` for possible options and help."; exit 1 ;;
esac done

[ -z "$action" ] && action="info"

case "$action" in
list) list ;;
add) checkbasics && askinfo && getboxes && getprofiles && finalize ;;


불러오는 중...
취소
저장