line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::ListDetector::Detector::Ecartis; |
2
|
|
|
|
|
|
|
|
3
|
39
|
|
|
39
|
|
256
|
use strict; |
|
39
|
|
|
|
|
87
|
|
|
39
|
|
|
|
|
1574
|
|
4
|
39
|
|
|
39
|
|
262
|
use warnings; |
|
39
|
|
|
|
|
81
|
|
|
39
|
|
|
|
|
1446
|
|
5
|
39
|
|
|
39
|
|
220
|
use base qw(Mail::ListDetector::Detector::Base); |
|
39
|
|
|
|
|
106
|
|
|
39
|
|
|
|
|
4437
|
|
6
|
39
|
|
|
39
|
|
247
|
use Mail::ListDetector::List; |
|
39
|
|
|
|
|
95
|
|
|
39
|
|
|
|
|
914
|
|
7
|
39
|
|
|
39
|
|
280
|
use Email::Valid; |
|
39
|
|
|
|
|
74
|
|
|
39
|
|
|
|
|
844
|
|
8
|
39
|
|
|
39
|
|
198
|
use Carp; |
|
39
|
|
|
|
|
73
|
|
|
39
|
|
|
|
|
5486
|
|
9
|
|
|
|
|
|
|
|
10
|
104
|
|
|
104
|
0
|
361
|
sub DEBUG { 0 } |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub match { |
13
|
39
|
|
|
39
|
1
|
195
|
my $self = shift; |
14
|
39
|
|
|
|
|
90
|
my $message = shift; |
15
|
39
|
50
|
|
|
|
331
|
print "Got message $message\n" if DEBUG; |
16
|
39
|
50
|
|
|
|
162
|
carp ("Mail::ListDetector::Detector::Ecartis - no message supplied") unless defined($message); |
17
|
39
|
|
|
39
|
|
265
|
use Email::Abstract; |
|
39
|
|
|
|
|
75
|
|
|
39
|
|
|
|
|
19600
|
|
18
|
39
|
|
|
|
|
206
|
my @senders = Email::Abstract->get_header($message, 'Sender'); |
19
|
39
|
|
|
|
|
2995
|
my $list; |
20
|
39
|
|
|
|
|
117
|
foreach my $sender (@senders) { |
21
|
22
|
|
|
|
|
53
|
chomp $sender; |
22
|
|
|
|
|
|
|
|
23
|
22
|
|
|
|
|
78
|
($list) = ($sender =~ /^owner-(\S+)$/); |
24
|
22
|
100
|
|
|
|
89
|
if (!(defined $list)) { |
25
|
18
|
50
|
|
|
|
63
|
print "Sender didn't match owner-, trying -owner\n" if DEBUG; |
26
|
18
|
100
|
|
|
|
100
|
if ($sender =~ /^(\S+?)-owner/) { |
27
|
1
|
50
|
|
|
|
4
|
print "Sender matched -owner, removing\n" if DEBUG; |
28
|
1
|
|
|
|
|
3
|
$list = $sender; |
29
|
1
|
|
|
|
|
5
|
$list =~ s/-owner@/@/; |
30
|
|
|
|
|
|
|
} else { |
31
|
17
|
50
|
|
|
|
52
|
print "Sender didn't match second owner form\n" if DEBUG; |
32
|
17
|
100
|
|
|
|
88
|
if ($sender =~ /^(\S+?)-bounce/) { |
33
|
1
|
50
|
|
|
|
4
|
print "Sender matched -bounce, removing\n" if DEBUG; |
34
|
1
|
|
|
|
|
3
|
$list = $sender; |
35
|
1
|
|
|
|
|
5
|
$list =~ s/-bounce@/@/; |
36
|
|
|
|
|
|
|
} else { |
37
|
16
|
50
|
|
|
|
47
|
print "Sender didn't match bounce form\n" if DEBUG; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
22
|
100
|
|
|
|
101
|
last if defined $list; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
39
|
100
|
|
|
|
496
|
return unless defined $list; |
45
|
6
|
|
|
|
|
16
|
chomp $list; |
46
|
6
|
50
|
|
|
|
22
|
print "Got list [$list]\n" if DEBUG; |
47
|
6
|
50
|
|
|
|
37
|
return unless Email::Valid->address($list); |
48
|
6
|
50
|
|
|
|
2177
|
print "List is valid email\n" if DEBUG; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# get Ecartis version |
51
|
6
|
|
|
|
|
32
|
my $lv = Email::Abstract->get_header($message, 'X-Ecartis-Version'); |
52
|
6
|
100
|
|
|
|
474
|
return undef unless defined $lv; |
53
|
1
|
|
|
|
|
3
|
chomp $lv; |
54
|
1
|
|
|
|
|
5
|
my $listname = Email::Abstract->get_header($message, 'X-List'); |
55
|
1
|
50
|
|
|
|
78
|
return undef unless defined $listname; |
56
|
1
|
|
|
|
|
2
|
chomp $listname; |
57
|
1
|
|
|
|
|
10
|
my $l = new Mail::ListDetector::List; |
58
|
1
|
|
|
|
|
7
|
$l->listsoftware($lv); |
59
|
1
|
|
|
|
|
6
|
$l->posting_address($list); |
60
|
1
|
|
|
|
|
4
|
$l->listname($listname); |
61
|
1
|
|
|
|
|
5
|
return $l; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
__END__ |