[spambayes-dev] [PATCH] Keep flags for maildir

Rocco Rutte pdmef at gmx.net
Wed Jul 8 14:08:18 CEST 2009


I don't know if spambayes is dead... anyway it's annoying that when it
learns a maildir message, it drops all the messages flags
(read/replied/trashed/etc).  The attached patch fixes it for me.

(please Cc me as I'm not on either list)


diff --git a/spambayes/scripts/sb_mboxtrain.py b/spambayes/scripts/sb_mboxtrain.py
--- a/spambayes/scripts/sb_mboxtrain.py
+++ b/spambayes/scripts/sb_mboxtrain.py
@@ -118,9 +118,13 @@ def maildir_train(h, path, is_spam, forc
     for fn in os.listdir(path):
         cfn = os.path.join(path, fn)
+        mflags = ':2,'
+        if mflags in cfn:
+            mflags = cfn[cfn.find(mflags):]
         tfn = os.path.normpath(os.path.join(path, "..", "tmp",
-                           "%d.%d_%d.%s" % (time.time(), pid,
-                                            counter, host)))
+                           "%d.%d_%d.%s%s" % (time.time(), pid,
+                                              counter, host,
+                                              mflags)))
         if (os.path.isdir(cfn)):
         counter += 1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/spambayes-dev/attachments/20090708/bc331779/attachment.pgp>

More information about the spambayes-dev mailing list