fix forwarded emails and posix whitespace regex
This commit is contained in:
parent
e50d51d3e5
commit
7955090f9f
@ -28,9 +28,9 @@ syncandnotify() {
|
|||||||
if [ "$newcount" -gt "0" ]; then
|
if [ "$newcount" -gt "0" ]; then
|
||||||
notify "$acc" "$newcount" &
|
notify "$acc" "$newcount" &
|
||||||
for file in $new; do
|
for file in $new; do
|
||||||
# Extract subject and sender from mail.
|
# Extract subject and sender from mail.
|
||||||
from=$(grep "^From: " "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if ($NF>=3)$NF=""; print $0 }' | tr -d "\"\'\<\>" | sed 's/^ \(.*\) $/\1/')
|
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=$(sed -n '/^Subject: /,/^.*:/p' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | head -n-1)
|
subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: /' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//')
|
||||||
notify-send "📧$from:" "$subject" &
|
notify-send "📧$from:" "$subject" &
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user