Removed Date header from Bogofilter input since it's ignored anyway

master
Thor 3 years ago
parent 797df79ec0
commit 2277142c45
  1. 10
      bogofilter.py
  2. 17
      config.json.example

@ -1,20 +1,18 @@
import subprocess
from email.utils import format_datetime
from datetime import datetime
import quopri
import os
DB_DIR = "."
DB_PATH = os.path.join(DB_DIR, "wordlist.db")
MAX_HAM = 0.07
MIN_SPAM = 0.25
MAX_HAM = 1.0 / 3.0
MIN_SPAM = 2.0 / 3.0
MIN_DEV = 2 * (MIN_SPAM - MAX_HAM) * 0.375
ROBS = 0.0178
ROBX = (MAX_HAM + MIN_SPAM) / 2
LOAD_COMMAND = ["bogoutil", "-l", DB_PATH]
COMMAND = ["bogofilter", "-T", "-c", "/dev/null", "-d", DB_DIR, "-o", "{},{}".format(MIN_SPAM, MAX_HAM), "-m", "{},{},{}".format(MIN_DEV, ROBS, ROBX)]
# Categories
SPAM = "S"
HAM = "H"
@ -50,7 +48,6 @@ class BogofilterResult:
class Mail:
def __init__(self, headers = {}, body = None):
self.headers = {**{
"Date": datetime.now(),
"Content-Type": "text/html; charset=\"UTF-8\""}, **headers}
self.body = body
@ -60,9 +57,6 @@ class Mail:
if key == "Subject":
value = "=?utf-8?Q?{}?=".format(quopri.encodestring(bytes(value, "utf-8"), header = True).decode("utf-8"))
if key == "Date":
value = format_datetime(value)
text += "{key}: {value}\n".format(key = key, value = value)
text += "\n"

@ -1,17 +0,0 @@
{
"name": "cringebot",
"defaults": {
"tag": "#cringebot",
"app_name": "Cringebot",
"rate_limit": 1,
"poll_interval": 10,
"max_age": 90
},
"clients": {
"mastodon.social": {},
"mastodon.xyz alt": {
"base_url": "https://mastodon.xyz",
"max_age": 60
}
}
}
Loading…
Cancel
Save