panel/lemons: mail.sh now considers all my accounts
This commit is contained in:
parent
81be051d8e
commit
637225311a
|
@ -2,22 +2,19 @@
|
||||||
|
|
||||||
[ -f ~/.secrets/accounts.sh ] && . ~/.secrets/accounts.sh || exit
|
[ -f ~/.secrets/accounts.sh ] && . ~/.secrets/accounts.sh || exit
|
||||||
|
|
||||||
feed=$(curl -u "${MAIL_USER}:${MAIL_PASS}" --silent https://mail.google.com/mail/feed/atom)
|
get-mail() {
|
||||||
con=$(echo $feed | grep -c "<fullcount>")
|
local feed=$(curl -u "$1:$2" --silent https://mail.google.com/mail/feed/atom)
|
||||||
num=$(echo $feed | grep -o "<entry>" | wc -l)
|
if [ "$(echo $feed | grep -c "<fullcount>")" -eq 1 ]
|
||||||
|
|
||||||
if [ "$con" -eq 1 ]
|
|
||||||
then
|
then
|
||||||
# if [ "$num" -gt 0 ]; then
|
echo $feed | grep -o "<entry>" | wc -l
|
||||||
# oldnum=0
|
|
||||||
# [ -f /tmp/newmail ] && oldnum=$(cat /tmp/newmail)
|
|
||||||
# echo "$num" > /tmp/newmail
|
|
||||||
# if [ "$num" -ne "$oldnum" ]
|
|
||||||
# then
|
|
||||||
# notify-send 'New email'
|
|
||||||
# fi
|
|
||||||
# fi
|
|
||||||
echo "M$num"
|
|
||||||
else
|
else
|
||||||
echo "M!"
|
>&2 echo "mail.sh: error with $1"
|
||||||
|
echo 0
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
a=$(get-mail "${MAIL1[USER]}" "${MAIL1[PASS]}")
|
||||||
|
b=$(get-mail "${MAIL2[USER]}" "${MAIL2[PASS]}")
|
||||||
|
c=$(get-mail "${MAIL3[USER]}" "${MAIL3[PASS]}")
|
||||||
|
|
||||||
|
echo M$(( $a + $b + $c ))
|
||||||
|
|
Loading…
Reference in a new issue