fix some logic and regex bugs and add 'draft' to list of ignored tags
This commit is contained in:
@@ -18,7 +18,7 @@ USETAGS=".+" # List of tags which shall be moved
|
||||
THREADTAGS=".+" # List of tags for which single, but connected messages in INBOX shall be tagged
|
||||
|
||||
BL_USETAGS=""
|
||||
BL_THREADTAGS="$TRASHTAG|$SPAMTAG|$ARCHTAG"
|
||||
BL_THREADTAGS="$TRASHTAG|$SPAMTAG|$ARCHTAG|draft"
|
||||
touch "$LOG" # Create logfile or update time stamp
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ while read line; do
|
||||
TAG=$(echo $line | cut -d";" -f1)
|
||||
FOL=$(echo $line | cut -d";" -f2)
|
||||
|
||||
if ! $(echo $BL_USETAGS | grep -q "$TAG,") && $(echo $TAG | grep -qE "$USETAGS"); then
|
||||
if ! $(echo $BL_USETAGS | grep -qE "${TAG}($|\|)") && $(echo $TAG | grep -qE "$USETAGS"); then
|
||||
BL_USETAGS="$TAG,$BL_USETAGS" # Add current tag to list of tags which do not have to be searched for another time
|
||||
|
||||
# TRASH tag "del"
|
||||
@@ -58,7 +58,7 @@ while read line; do
|
||||
# DEFAULT
|
||||
else
|
||||
# For some tags, also tag its threads
|
||||
if ! $(echo $BL_THREADTAGS | grep -q "$TAG,") && $(echo $TAG | grep -qE "$THREADTAGS"); then
|
||||
if ! $(echo $BL_THREADTAGS | grep -qE "${TAG}($|\|)") && $(echo $TAG | grep -qE "$THREADTAGS"); then
|
||||
# If one file is tagged (except del, spam, archive), also tag the other mails of its thread respectively, IF they are located in INBOX [TODO: is this the best approach?]. Only then they can be moved by this script
|
||||
|
||||
# 1. Get thread ids of all entries with the searched tag
|
||||
@@ -77,10 +77,11 @@ while read line; do
|
||||
logrun notmuch tag +"$TAG" -- "$m"
|
||||
fi
|
||||
done
|
||||
|
||||
# Search for these lone messages in INBOX
|
||||
HITFILES=$(notmuch search --output=files --exclude=false path:INBOX/** and tag:$TAG | grep "$MAILDIR/INBOX/")
|
||||
fi
|
||||
|
||||
# Search for these lone messages in INBOX
|
||||
HITFILES=$(notmuch search --output=files --exclude=false path:INBOX/** and tag:$TAG | grep "$MAILDIR/INBOX/")
|
||||
fi
|
||||
|
||||
# Move files to their destination folders
|
||||
|
||||
Reference in New Issue
Block a user