X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=learn_from_spam;h=071f7f1f49576eef9fff9cb1c00ca1dbe5aafc84;hb=dcce90e77c92202b5fadca48de6fd1cefc41ff79;hp=4bc770c7e067b26a119387f05f8a97b89058a96b;hpb=7c0c16ebb53bbd94753ab475075f7e1c6c6d7fd5;p=bin.git diff --git a/learn_from_spam b/learn_from_spam index 4bc770c..071f7f1 100755 --- a/learn_from_spam +++ b/learn_from_spam @@ -8,7 +8,7 @@ SPAM_CHECK="spamassassin -e" # these are for spamc SPAM_REPORT="spamc --learntype=spam" HAM_REPORT="spamc --learntype=ham" -SPAM_CHECK="spamc -c" +SPAM_CHECK="spamc -s $((100 * 1024 * 1024)) -c" # needs rules directories NEEDS_SPAM_RULES="$(echo ~/Maildir/spam/needs_rules)" @@ -21,8 +21,8 @@ if [ "$(basename $0)" = "learn_from_spam" ]; then fi; formail -c < "$file" | grep -e '^From ' -e 'From: ' | spamassassin --add-to-blacklist >/dev/null 2>&1; formail -c < "$file" | grep -e '^From ' -e 'From: ' | spamassassin --remove-from-whitelist >/dev/null 2>&1; - # check to see if it's still spam - if ! $SPAM_CHECK < "$file" >/dev/null 2>&1; then + # check to see if it's still ham + if $SPAM_CHECK < "$file" >/dev/null 2>&1; then mkdir -p "${NEEDS_SPAM_RULES}/cur"; TMP="$(mktemp -d)" trap "rm -f '$TMP'/file; rmdir '$TMP'" EXIT @@ -39,7 +39,7 @@ elif [ "$(basename $0)" = "learn_from_ham" ]; then for file in "$@"; do $HAM_REPORT < "$file" >/dev/null 2>&1; formail -c < "$file" |grep -e '^From ' -e 'From: ' -e 'To: ' -e 'Cc: '|spamassassin --add-to-whitelist >/dev/null 2>&1; - if $SPAM_CHECK < "$file" >/dev/null 2>&1; then + if ! $SPAM_CHECK < "$file" >/dev/null 2>&1; then mkdir -p "${NEEDS_HAM_RULES}/cur"; TMP="$(mktemp -d)" trap "rm -f '$TMP'/file; rmdir '$TMP'" EXIT