diff --git a/astroid/poll.sh b/astroid/poll.sh index ec7742c..13a6f79 100755 --- a/astroid/poll.sh +++ b/astroid/poll.sh @@ -4,11 +4,6 @@ CURDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) TMP=/tmp/status source "$TMP" - -# Move selectedly tagged mails to folders if they are only in INBOX -echo "[DEBUG] Move tagged mails in INBOX to folders (move-tag.sh)" -bash $CURDIR/scripts/move-tag.sh ${var_conn} - # If offline mode, do a quick sync if [ "$var_conn" == "off" ]; then echo "[INFO] Offline mode enabled. Do a quick sync" @@ -17,9 +12,18 @@ else echo "[INFO] Do a normal sync." offlineimap fi + +# Index new mails which will be tagged with notmuch's new.tags echo "[DEBUG] Sync notmuch database with new mails" notmuch new +# Move selectedly tagged mails to folders if they are only in INBOX +echo "[DEBUG] Move tagged mails in INBOX to folders (move-tag.sh)" +bash $CURDIR/scripts/move-tag.sh ${var_conn} + +# Index again after mails have been moved +echo "[DEBUG] Update notmuch database with possibly moved mails" +notmuch new ### Sort emails