1 |
--- /usr/share/qpsmtpd/plugins/disclaimer.orig 2008-02-27 10:34:17.000000000 +0100 |
2 |
+++ /usr/share/qpsmtpd/plugins/disclaimer 2008-06-19 16:19:43.000000000 +0200 |
3 |
@@ -10,6 +10,16 @@ |
4 |
%{$self->{_args}} = @args; |
5 |
} |
6 |
|
7 |
+sub read_disclaimer { |
8 |
+ my ($self, $disclaimer_file) = @_; |
9 |
+ my $disclaimer_dir = $self->{_args}->{disclaimer_dir} || "/service/qpsmtpd/config/"; |
10 |
+ return () unless open DISCLAIMER, "<$disclaimer_dir/$disclaimer_file"; |
11 |
+ my @lines = <DISCLAIMER>; |
12 |
+ chomp @lines; |
13 |
+ close DISCLAIMER; |
14 |
+ return @lines; |
15 |
+} |
16 |
+ |
17 |
sub hook_data_post { |
18 |
my ($self, $transaction) = @_; |
19 |
|
20 |
@@ -45,10 +55,10 @@ |
21 |
|
22 |
my $specific = 0; |
23 |
my @lines; |
24 |
- if ( @lines = $self->qp->config("disclaimer_$fromhost") ) { |
25 |
+ if ( @lines = $self->read_disclaimer("disclaimer_$fromhost") ) { |
26 |
$self->log(LOGDEBUG, "Found disclaimer for domain: $fromhost"); |
27 |
$specific = 1; |
28 |
- } elsif ( @lines = $self->qp->config("disclaimer") ) { |
29 |
+ } elsif ( @lines = $self->read_disclaimer("disclaimer") ) { |
30 |
$self->log(LOGDEBUG, "Found general disclaimer"); |
31 |
} else { |
32 |
$self->log(LOGERROR, "No disclaimer found for domain: $fromhost"); |