[spambayes-dev] Three patches for better Evolution integration

Barry Warsaw barry at python.org
Mon Nov 24 09:53:37 EST 2003


I finally spent some time this weekend trying to integrate sb and Ximian
Evolution (I use 1.4.5 as my primary mail reader).  As others have
pointed out before, Evolution lets you create a filter, one of the
criteria of which can be "pipe message to shell script".  Then Evolution
can match the exit code of the script to determine what to do with the
message.

So I use sb_imapfilter.py to train a local database, then I run
sb_xmlrpcserver.py to do the scoring against this database.  I wrote a
small client called sb_score.py which basically just pipes stdin to the
server, calls XMLHammie.score() and compares the float return value
against spam_cutoff and ham_cutoff.  The script returns 0 for ham, 1 for
unsure, and 2 for spam (also -1 if there's an error).  Currently, I'm
just moving spam to a separate folder, leaving ham and unsure in my
inbox.  I'll probably refine that soon to move unsures as well.

I've uploaded three patches to SF.  848311 is a small patch to
sb_imapfilter.py so that it honors html_ui::launch_browser when the -b
option is given.  I wanted it to start the web server and not start a
browser, but there didn't seem to be any way to make this happen.

In 848314 I had to make several changes to sb_xmlrpcserver.py to 1) make
the socket reusable, 2) fix XMLHammie.score().  The latter method was
trying to wrap the float return value in a Binary, but that's both
broken and unnecessary <wink>.  Now it just returns the float directly.

848319 is my sb_score.py script.

I don't like sb_imapfilter.py's tendency to create copies of messages
(with one marked deleted) in my ham and spam training folders.  I
vaguely remember some discussion about this and I'm not sure if it's
fixable or not (I'm using uw_imap -- yeah, yeah, I know, I know).  I may
try, but if I fail, I'll probably just rsync over those two folders and
do an mbox train on them.

Evolution is applying the filter and moving the message, and that all
looks good.  Evolution doesn't seem any slower <wink>.   I had two
problems though.  As I was getting things going, I'd stop my xmlrpc
server and retrain, then restart the server.  This seemed to give
Evolution fits, which it spitting up cryptic error messages and forcing
a restart.  This only happens occasionally though, but definitely seems
to be related to my training regimen.

It also wasn't doing a very good job of classifying messages.  Of
course, maybe that had something to do with bugs in my
bayescustomize.ini file where I swapped my ham and spam training folders
;).  I've fixed that now, blown away my database, retrained, and now am
awaiting the daily flood of messages, both tasty and rancid.

-Barry





More information about the spambayes-dev mailing list