Re: [Evolution-hackers] SpamBayes



On Fri, 2007-07-20 at 18:17 +0200, Rasmus Toftdahl Olesen wrote:
> Hi There
> 
> I am the author of the SpamBayes using spam filtering plugin for
> Evolution, so far i seem to have things working nicely (i based my code
> on the Bogofilter plugin).
> 
> But there is one thing i am missing, i would like to be able to track
> which messages have been marked as what - in SpamBayes you need to
> untrain a wrongly tagged message before you can train on it tagged the
> right way.
> 
> In other words, a message can have three states: not rated, junk or
> not-junk. If the user wishes to train a message as e.g. junk i need to
> know if it has previously been trained as not-junk (so i can untrain it)
> before i train it as junk.
> 
> Rather than maintaining a database of "seen" messages on my own, i
> thought it would be nice (as well as a good debugging feature) to be
> able to add a custom header (X-Evolution-Spambayes-Plugin) to each
> message as it is seen by the SpamBayes plugin, this would allow me to
> see whether the message is new or not.
> 
> Is this possible?

Try using camel_medium_add_header. Attached is a patch. Verify.

Your plugin needs to be improved a little more. The bazaar sources link
leads to an empty page. If I download the source tarball, it does not
have configure.in so I can't run autogen. I needed that because your
configure script had 2.10 hard-coded. Trunk is 2.11.*

> 
> I have tried using camel_medium_set_header and camel_medium_get_header
> on the CamelMimeMessage passed to the "junk", "non-junk" hooks, but that
> doesn't seem to work - but doesn't crash Evolution either.
> 
> Thanks for any insight you can provide.
> 
> My plugin is available form here:
> http://halfdans.net/wiki.py/EvolutionSpamBayesPlugin
> 
-- 
Sankar

 Novell, Inc. 
Software for the Open Enterprise™
http://www.novell.com
--- sb-junk-filter.c	2007-07-23 12:49:45.000000000 +0530
+++ sb-junk-filter.c.vcs	2007-07-23 12:32:02.000000000 +0530
@@ -302,7 +302,7 @@ void em_junk_sb_report_junk (EPlugin *ep
     if ( header && strcmp(header, PLUGIN_HEADER_HAM) == 0 ) {
         em_junk_sb_report_non_junk_untrain ( msg );
     }
-    camel_medium_add_header ( CAMEL_MEDIUM(msg), PLUGIN_HEADER, PLUGIN_HEADER_SPAM );
+    camel_medium_set_header ( CAMEL_MEDIUM(msg), PLUGIN_HEADER, PLUGIN_HEADER_SPAM );
     
     gchar *argv[] = {
         SPAMBAYES_CLIENT_BINARY,
@@ -327,7 +327,7 @@ void em_junk_sb_report_non_junk (EPlugin
     if ( header && strcmp(header, PLUGIN_HEADER_SPAM) == 0 ) {
         em_junk_sb_report_junk_untrain ( msg );
     }
-    camel_medium_add_header ( CAMEL_MEDIUM(msg), PLUGIN_HEADER, PLUGIN_HEADER_HAM );
+    camel_medium_set_header ( CAMEL_MEDIUM(msg), PLUGIN_HEADER, PLUGIN_HEADER_HAM );
     
     gchar *argv[] = {
         SPAMBAYES_CLIENT_BINARY,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]