move astroid config to separate folder

This commit is contained in:
2017-04-13 12:54:32 +02:00
parent 6ceb857a9a
commit 9e4f99145f
16 changed files with 0 additions and 0 deletions

26
astroid/hooks/unspam Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/bash
#
# $1 = message id
#
DIR_JUNK="INBOX.Junk"
DIR_INBOX="INBOX"
LOG="/home/$USER/.config/astroid/hooks/hook.log"
ID=$1
FILE=$(notmuch search --exclude=false --output=files "id:$ID") # get actual file path of MID
if [[ $(notmuch search "id:$ID" and tag:spam) ]]; then # only do something if mail is spam
notmuch tag -spam -- "id:$ID" # unspam mail
echo "spam removed from $ID" >> $LOG
else
echo "no spam $ID" >> $LOG
fi
if $(echo $FILE | grep -q $DIR_JUNK); then # if mail is in spam dir
FILE_NEW=$(echo $FILE | sed "s|$DIR_JUNK/|$DIR_INBOX/|")
mv "$FILE" "$FILE_NEW" # move from spamdir to inbox
echo "moved $FILE to $FILE_NEW" >> $LOG
else
echo "not in junk folder $FILE" >> $LOG
fi