prep fix
This commit is contained in:
		@@ -4,7 +4,7 @@
 | 
				
			|||||||
# Run only if user logged in (prevent cron errors)
 | 
					# Run only if user logged in (prevent cron errors)
 | 
				
			||||||
pgrep -u "$USER" >/dev/null || exit
 | 
					pgrep -u "$USER" >/dev/null || exit
 | 
				
			||||||
# Run only if not already running in other instance
 | 
					# Run only if not already running in other instance
 | 
				
			||||||
[ "$(pgrep -xf "sh /usr/bin/mailsync.*" | wc -l)" -eq 2 ] || exit
 | 
					pgrep -x mailsync >/dev/null && exit
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Checks for internet connection and set notification script.
 | 
					# Checks for internet connection and set notification script.
 | 
				
			||||||
ping -q -c 1 1.1.1.1 > /dev/null || exit
 | 
					ping -q -c 1 1.1.1.1 > /dev/null || exit
 | 
				
			||||||
@@ -28,7 +28,7 @@ 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=$(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" &
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user