Make mail messaging better (use .mail-sync file as time stamp).

This commit is contained in:
Ivan Malison 2014-12-11 23:19:12 -08:00
parent e5d3981798
commit 91de69b8c7
2 changed files with 7 additions and 2 deletions

1
.gitignore vendored
View File

@ -30,3 +30,4 @@ dotfiles/config/user-dirs.dirs
dotfiles/config/user-dirs.locale dotfiles/config/user-dirs.locale
dotfiles/config/vlc/ dotfiles/config/vlc/
dotfiles/config/nemo/ dotfiles/config/nemo/
/.mail-sync

View File

@ -1,5 +1,6 @@
MAILDIR="$HOME/Mail" MAILDIR="$HOME/Mail"
DBUS_COOKIE="$HOME/.sauron-dbus" DBUS_COOKIE="$HOME/.sauron-dbus"
SYNC_STAMP="$HOME/.mail-sync"
function sauron_msg { function sauron_msg {
if test -z "$DBUS_SESSION_BUS_ADDRESS"; then if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
@ -22,7 +23,10 @@ function sauron_msg {
function update_mail { function update_mail {
offlineimap offlineimap
for f in `find "$MAILDIR/INBOX/" -mmin -5 -a -type f`; do touch "${SYNC_STAMP}.in-progress"
sauron_msg "Gmail" "$(mu view $f | grep -B 10 Date)" for f in `find "$MAILDIR" -cnewer $SYNC_STAMP -a -type f`; do
local message="$(mu view $f | grep -B 10 Date)"
test -n "$message" && sauron_msg "Gmail" "$message"
done done
mv "${SYNC_STAMP}.in-progress" $SYNC_STAMP
} }