aboutsummaryrefslogtreecommitdiff
path: root/philter.sh
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-09-18 16:47:55 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-09-18 16:47:55 -0300
commitb4e2708c6f8cc2191c581aef404803478e65e678 (patch)
tree703d3f7f8f96d9564e7cc3f8ebf85a38c93ab3e1 /philter.sh
parent4fdd3ebb2b0622fb6cff7376a02a5b92c1aba2ae (diff)
downloadscripts-b4e2708c6f8cc2191c581aef404803478e65e678.tar.gz
scripts-b4e2708c6f8cc2191c581aef404803478e65e678.tar.bz2
Moved scripts to custom repos
Diffstat (limited to 'philter.sh')
-rwxr-xr-xphilter.sh67
1 files changed, 0 insertions, 67 deletions
diff --git a/philter.sh b/philter.sh
deleted file mode 100755
index f260a96..0000000
--- a/philter.sh
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/bash
-#
-# Maildir simple filter
-# Feedback: rhatto at riseup.net | gpl
-#
-
-PREFILTER="$HOME/apps/scripts/philter.py"
-BASE="$HOME/mail/"
-MAILBOXES="$BASE/Sync/"
-INBOXES=""
-#TRASHCAN="$BASE/INBOX.Trash/cur"
-TRASHCAN="$BASE/INBOX.Trash/new"
-SUBJECT="yes" # wheter to filter subject
-DEL="no" # delete the message
-BOGOFILTER="yes"
-FILTER="***SPAM***"
-
-# Load configuration
-if [ -e "$HOME/.config/scripts/philter" ]; then
- source $HOME/.config/scripts/philter
-fi
-
-for account in $INBOXES; do
-
- NEWBOX="$MAILBOXES/$account/INBOX/new"
-
- if [ -x $PREFILTER ]; then
- $PREFILTER
- fi
-
- cont="0"
- cd $NEWBOX
-
- for file in `ls -1`; do
- if grep -m 1 -e "X-Bogosity" "$file" | grep -q "Spam"; then
- mv "$file" "$TRASHCAN"
- if [[ "$DEL" == "yes" ]]; then
- rm "$TRASHCAN/$file"
- fi
- ((cont++))
- elif [[ "$BOGOFILTER" == "yes" ]]; then
- # bogofilter
- if cat $file | bogofilter -u -e -p | grep -q -e "^X-Bogosity: Spam, tests=bogofilter"; then
- mv "$file" "$TRASHCAN"
- if [[ "$DEL" == "yes" ]]; then
- rm "$TRASHCAN/$file"
- fi
- ((cont++))
- fi
- fi
- done
-
- if [ ! -z "$SUBJECT" ]; then
- for file in `ls -1`; do
- if grep -m 1 "$FILTER" "$file" | grep -q "Subject"; then
- mv "$file" "$TRASHCAN"
- if [[ "$DEL" == "yes" ]]; then
- rm "$TRASHCAN/$file"
- fi
- ((cont++))
- fi
- done
- fi
-
- echo "Total: $cont filtered messages for account $account."
-
-done