Browse Source

Remove non-unicode characters

pull/328/head
thehnm 5 years ago
parent
commit
77052ecc33
1 changed files with 2 additions and 3 deletions
  1. +2
    -3
      bin/mailsync

+ 2
- 3
bin/mailsync View File

@@ -16,7 +16,7 @@ export DISPLAY=:0.0
if [ "$(uname)" = "Darwin" ]; then if [ "$(uname)" = "Darwin" ]; then
notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;} notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;}
else else
notify() { notify-send "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." ;}
notify() { notify-send "mutt-wizard" "$2 new mail(s) in \`$1\` account." ;}
fi fi


# Check account for new mail. Notify if there is new content. # Check account for new mail. Notify if there is new content.
@@ -31,7 +31,7 @@ syncandnotify() {
# Extract subject and sender from mail. # Extract subject and sender from mail.
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:]]*$//') 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') 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')
notify-send "📧$from:" "$subject" &
notify-send "$from:" "$subject" &
done done
fi fi
} }
@@ -54,7 +54,6 @@ done


wait wait
rm -f /tmp/imapsyncicon_"$USER" rm -f /tmp/imapsyncicon_"$USER"
pkill -RTMIN+12 i3blocks >/dev/null 2>&1


notmuch new 2>/dev/null notmuch new 2>/dev/null




Loading…
Cancel
Save