diff options
author | cebka@lenovo-laptop <cebka@lenovo-laptop> | 2010-03-01 18:37:06 +0300 |
---|---|---|
committer | cebka@lenovo-laptop <cebka@lenovo-laptop> | 2010-03-01 18:37:06 +0300 |
commit | 74cf00015278784d04d26b44bcf326f9493f7d62 (patch) | |
tree | afe42b0a47504bf383d755e1b3254e1164944712 /rspamc.pl.in | |
parent | 0fec0b5c2d20fb505f1b8345d48b5098fe5598f6 (diff) | |
download | rspamd-74cf00015278784d04d26b44bcf326f9493f7d62.tar.gz rspamd-74cf00015278784d04d26b44bcf326f9493f7d62.zip |
* Add weights command for getting weights of each message by each statfile
* Add ability to specify multiplier when learning
* Add statistics about spam and ham messages
Diffstat (limited to 'rspamc.pl.in')
-rwxr-xr-x | rspamc.pl.in | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/rspamc.pl.in b/rspamc.pl.in index 4dddc7e3b..19bcab3f7 100755 --- a/rspamc.pl.in +++ b/rspamc.pl.in @@ -211,7 +211,7 @@ sub do_control_command { if (do_ctrl_auth ($sock)) { my $len = length ($input); print "Sending $len bytes...\n"; - syswrite $sock, "learn $cfg{'statfile'} $len" . $CRLF; + syswrite $sock, "learn $cfg{'statfile'} $len -w $cfg{weight}" . $CRLF; syswrite $sock, $input . $CRLF; if (defined (my $reply = <$sock>)) { if ($reply =~ /^learn ok, sum weight: ([0-9.]+)/) { @@ -226,6 +226,18 @@ sub do_control_command { print "Authentication failed\n"; } } + if ($cfg{'command'} =~ /^weights$/i) { + die "statfile is not specified to weights command" if !$cfg{'statfile'}; + + + my $len = length ($input); + print "Sending $len bytes...\n"; + syswrite $sock, "weights $cfg{'statfile'} $len" . $CRLF; + syswrite $sock, $input . $CRLF; + if (defined (my $reply = <$sock>)) { + print $_; + } + } elsif ($cfg{'command'} =~ /(reload|shutdown)/i) { if (do_ctrl_auth ($sock)) { syswrite $sock, $cfg{'command'} . $CRLF; @@ -540,7 +552,7 @@ else { die "unknown command $cmd"; } -if ($cmd =~ /SYMBOLS|SCAN|PROCESS|CHECK|REPORT_IFSPAM|REPORT|URLS|EMAILS|LEARN|FUZZY_ADD|FUZZY_DEL/i) { +if ($cmd =~ /SYMBOLS|SCAN|PROCESS|CHECK|REPORT_IFSPAM|REPORT|URLS|EMAILS|LEARN|FUZZY_ADD|FUZZY_DEL|WEIGHTS/i) { $cfg{'require_input'} = 1; } |