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
|
THREADTAGS=".+" # List of tags for which single, but connected messages in INBOX shall be tagged
|
||||||
|
|
||||||
BL_USETAGS=""
|
BL_USETAGS=""
|
||||||
BL_THREADTAGS="$TRASHTAG|$SPAMTAG|$ARCHTAG"
|
BL_THREADTAGS="$TRASHTAG|$SPAMTAG|$ARCHTAG|draft"
|
||||||
touch "$LOG" # Create logfile or update time stamp
|
touch "$LOG" # Create logfile or update time stamp
|
||||||
|
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ while read line; do
|
|||||||
TAG=$(echo $line | cut -d";" -f1)
|
TAG=$(echo $line | cut -d";" -f1)
|
||||||
FOL=$(echo $line | cut -d";" -f2)
|
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
|
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"
|
# TRASH tag "del"
|
||||||
@@ -58,7 +58,7 @@ while read line; do
|
|||||||
# DEFAULT
|
# DEFAULT
|
||||||
else
|
else
|
||||||
# For some tags, also tag its threads
|
# 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
|
# 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
|
# 1. Get thread ids of all entries with the searched tag
|
||||||
@@ -77,12 +77,13 @@ while read line; do
|
|||||||
logrun notmuch tag +"$TAG" -- "$m"
|
logrun notmuch tag +"$TAG" -- "$m"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
|
||||||
|
|
||||||
# Search for these lone messages in INBOX
|
# Search for these lone messages in INBOX
|
||||||
HITFILES=$(notmuch search --output=files --exclude=false path:INBOX/** and tag:$TAG | grep "$MAILDIR/INBOX/")
|
HITFILES=$(notmuch search --output=files --exclude=false path:INBOX/** and tag:$TAG | grep "$MAILDIR/INBOX/")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
# Move files to their destination folders
|
# Move files to their destination folders
|
||||||
for m in $HITFILES; do
|
for m in $HITFILES; do
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user