summaryrefslogtreecommitdiff
path: root/fml/lib/FML/Process
diff options
context:
space:
mode:
authorfukachan <fukachan>2004-06-24 10:40:24 +0000
committerfukachan <fukachan>2004-06-24 10:40:24 +0000
commitf157d82a780bebb5701bdcd6cbd3891aae3d58d7 (patch)
tree1ea09602bb06e144be0c3e347d2a2dc995d4f102 /fml/lib/FML/Process
parent1b57a843fab03dddc01ececeb134c48c33b8cf63 (diff)
downloadfml8-f157d82a780bebb5701bdcd6cbd3891aae3d58d7.tar.gz
fml8-f157d82a780bebb5701bdcd6cbd3891aae3d58d7.tar.bz2
fml8-f157d82a780bebb5701bdcd6cbd3891aae3d58d7.zip
preliminary support of build-in virus/spam checker.
Diffstat (limited to 'fml/lib/FML/Process')
-rw-r--r--fml/lib/FML/Process/Distribute.pm21
-rw-r--r--fml/lib/FML/Process/State.pm58
2 files changed, 77 insertions, 2 deletions
diff --git a/fml/lib/FML/Process/Distribute.pm b/fml/lib/FML/Process/Distribute.pm
index 27c5dae1..1a1fd9f5 100644
--- a/fml/lib/FML/Process/Distribute.pm
+++ b/fml/lib/FML/Process/Distribute.pm
@@ -3,7 +3,7 @@
# Copyright (C) 2000,2001,2002,2003,2004 Ken'ichi Fukamachi
# All rights reserved.
#
-# $FML: Distribute.pm,v 1.148 2004/05/22 06:42:11 fukachan Exp $
+# $FML: Distribute.pm,v 1.149 2004/05/25 03:54:28 fukachan Exp $
#
package FML::Process::Distribute;
@@ -472,6 +472,25 @@ sub _header_rewrite
}
}
+ # spam/virus checker
+ my $is_spam = $curproc->filter_state_spam_checker_get_error() || '';
+ my $is_virus = $curproc->filter_state_virus_checker_get_error() || '';
+ if ($is_spam || $is_virus) {
+ my $r = '';
+ if ($is_spam) {
+ $r .= $r ? " " : '';
+ $r .= "SPAM=YES ($is_spam)";
+ }
+ if ($is_virus) {
+ $r .= $r ? ", " : '';
+ $r .= "VIRUS=YES ($is_virus)";
+ }
+ $header->add("X-ML-Content-Filter", $r) if $r;
+ }
+ else {
+ $header->add("X-ML-Content-Filter", "SPAM=NO VIRUS=NO") if 0;
+ }
+
$eval = $config->get_hook( 'article_header_rewrite_end_hook' );
if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; }
}
diff --git a/fml/lib/FML/Process/State.pm b/fml/lib/FML/Process/State.pm
index b12300d8..aa45faa9 100644
--- a/fml/lib/FML/Process/State.pm
+++ b/fml/lib/FML/Process/State.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: State.pm,v 1.9 2004/05/19 09:15:15 fukachan Exp $
+# $FML: State.pm,v 1.10 2004/05/25 04:18:50 fukachan Exp $
#
package FML::Process::State;
@@ -517,6 +517,62 @@ sub filter_state_get_error
}
+# Descriptions: save the spam filter error for later use.
+# Arguments: OBJ($curproc) STR($category) STR($code)
+# Side Effects: update pcb.
+# Return Value: none
+sub filter_state_spam_checker_set_error
+{
+ my ($curproc, $code) = @_;
+ my $category = "spam_checker";
+ my $pcb = $curproc->pcb();
+
+ $pcb->set("filter_state", $category, $code || 0);
+}
+
+
+# Descriptions: get the spam filter error.
+# Arguments: OBJ($curproc) STR($category)
+# Side Effects: update pcb.
+# Return Value: none
+sub filter_state_spam_checker_get_error
+{
+ my ($curproc) = @_;
+ my $category = "spam_checker";
+ my $pcb = $curproc->pcb();
+
+ return( $pcb->get("filter_state", $category) || 0 );
+}
+
+
+# Descriptions: save the virus filter error for later use.
+# Arguments: OBJ($curproc) STR($category) STR($code)
+# Side Effects: update pcb.
+# Return Value: none
+sub filter_state_virus_checker_set_error
+{
+ my ($curproc, $code) = @_;
+ my $category = "virus_checker";
+ my $pcb = $curproc->pcb();
+
+ $pcb->set("filter_state", $category, $code || 0);
+}
+
+
+# Descriptions: get the virus filter error.
+# Arguments: OBJ($curproc) STR($category)
+# Side Effects: update pcb.
+# Return Value: none
+sub filter_state_virus_checker_get_error
+{
+ my ($curproc) = @_;
+ my $category = "virus_checker";
+ my $pcb = $curproc->pcb();
+
+ return( $pcb->get("filter_state", $category) || 0 );
+}
+
+
=head1 SMTP STATE
=head2 smtp_server_state_set_error($mta)