summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2017-10-24 14:32:00 +0200
committerMatěj Cepl <mcepl@cepl.eu>2017-10-24 14:32:00 +0200
commit90a3409f0d7ab0e5ed0f70858ca4b321071a67a0 (patch)
tree87c0d96dd052e07631e23ee3ce5c40cf55abb0af
parent73ac4154371fb32fac5ff943ca0b2e63c153a51b (diff)
downloadimap-folder-training-90a3409f0d7ab0e5ed0f70858ca4b321071a67a0.tar.gz
Split what we think is spam (_suspects) and what is spam for retraining (Junk)
-rwxr-xr-xcheck_bogofilter.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/check_bogofilter.py b/check_bogofilter.py
index 89253ea..f581f92 100755
--- a/check_bogofilter.py
+++ b/check_bogofilter.py
@@ -29,7 +29,7 @@ def move_messages(ids, target):
client.uid('STORE', ids_str, '+FLAGS', r'(\Deleted)')
-def process_folder(proc_fld_name, junk_fld, unsure_fld,
+def process_folder(proc_fld_name, target_fld, unsure_fld,
bogofilter_param=['-l']):
ham_msgs = []
@@ -84,7 +84,7 @@ def process_folder(proc_fld_name, junk_fld, unsure_fld,
else: # 3 or something else I/O error
raise IOError('Bogofilter failed with error %d', ret_code)
- move_messages(spam_msgs, junk_fld)
+ move_messages(spam_msgs, target_fld)
move_messages(unsure_msgs, unsure_fld)
if ham_msgs:
client.uid('STORE', ','.join(ham_msgs), '-FLAGS', r'(\Seen)')
@@ -104,7 +104,7 @@ server = config.get("imap-training", "server")
client = imaplib.IMAP4_SSL(server)
client.login(login, password)
-processedCounter += process_folder('INBOX', 'Junk', 'Unsure')
+processedCounter += process_folder('INBOX', '_suspects', '_unsure')
client.logout()