line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::ListDetector::Detector::Listar; |
2
|
|
|
|
|
|
|
|
3
|
39
|
|
|
39
|
|
196
|
use strict; |
|
39
|
|
|
|
|
76
|
|
|
39
|
|
|
|
|
1410
|
|
4
|
39
|
|
|
39
|
|
208
|
use warnings; |
|
39
|
|
|
|
|
62
|
|
|
39
|
|
|
|
|
1257
|
|
5
|
|
|
|
|
|
|
|
6
|
39
|
|
|
39
|
|
352
|
use base qw(Mail::ListDetector::Detector::Base); |
|
39
|
|
|
|
|
86
|
|
|
39
|
|
|
|
|
3230
|
|
7
|
39
|
|
|
39
|
|
253
|
use Mail::ListDetector::List; |
|
39
|
|
|
|
|
63
|
|
|
39
|
|
|
|
|
920
|
|
8
|
39
|
|
|
39
|
|
42201
|
use Email::Valid; |
|
39
|
|
|
|
|
29109180
|
|
|
39
|
|
|
|
|
1677
|
|
9
|
39
|
|
|
39
|
|
428
|
use Carp; |
|
39
|
|
|
|
|
92
|
|
|
39
|
|
|
|
|
6138
|
|
10
|
|
|
|
|
|
|
|
11
|
110
|
|
|
110
|
0
|
373
|
sub DEBUG { 0 } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub match { |
14
|
40
|
|
|
40
|
1
|
117
|
my $self = shift; |
15
|
40
|
|
|
|
|
103
|
my $message = shift; |
16
|
40
|
50
|
|
|
|
185
|
print "Got message $message\n" if DEBUG; |
17
|
40
|
50
|
|
|
|
159
|
carp ("Mail::ListDetector::Detector::Listar - no message supplied") unless defined($message); |
18
|
39
|
|
|
39
|
|
281
|
use Email::Abstract; |
|
39
|
|
|
|
|
87
|
|
|
39
|
|
|
|
|
22123
|
|
19
|
40
|
|
|
|
|
212
|
my @senders = Email::Abstract->get_header($message, 'Sender'); |
20
|
40
|
|
|
|
|
2962
|
my $list; |
21
|
40
|
|
|
|
|
122
|
foreach my $sender (@senders) { |
22
|
23
|
|
|
|
|
55
|
chomp $sender; |
23
|
|
|
|
|
|
|
|
24
|
23
|
|
|
|
|
86
|
($list) = ($sender =~ /^owner-(\S+)$/); |
25
|
23
|
100
|
|
|
|
90
|
if (!(defined $list)) { |
26
|
19
|
50
|
|
|
|
64
|
print "Sender didn't match owner-, trying -owner\n" if DEBUG; |
27
|
19
|
100
|
|
|
|
108
|
if ($sender =~ /^(\S+?)-owner/) { |
28
|
1
|
50
|
|
|
|
3
|
print "Sender matched -owner, removing\n" if DEBUG; |
29
|
1
|
|
|
|
|
3
|
$list = $sender; |
30
|
1
|
|
|
|
|
6
|
$list =~ s/-owner@/@/; |
31
|
|
|
|
|
|
|
} else { |
32
|
18
|
50
|
|
|
|
55
|
print "Sender didn't match second owner form\n" if DEBUG; |
33
|
18
|
100
|
|
|
|
94
|
if ($sender =~ /^(\S+?)-bounce/) { |
34
|
2
|
50
|
|
|
|
6
|
print "Sender matched -bounce, removing\n" if DEBUG; |
35
|
2
|
|
|
|
|
6
|
$list = $sender; |
36
|
2
|
|
|
|
|
10
|
$list =~ s/-bounce@/@/; |
37
|
|
|
|
|
|
|
} else { |
38
|
16
|
50
|
|
|
|
48
|
print "Sender didn't match bounce form\n" if DEBUG; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
23
|
100
|
|
|
|
105
|
last if defined $list; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
40
|
100
|
|
|
|
539
|
return unless defined $list; |
46
|
7
|
|
|
|
|
14
|
chomp $list; |
47
|
7
|
50
|
|
|
|
22
|
print "Got list [$list]\n" if DEBUG; |
48
|
7
|
50
|
|
|
|
71
|
return unless Email::Valid->address($list); |
49
|
7
|
50
|
|
|
|
14784
|
print "List is valid email\n" if DEBUG; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# get listar version |
52
|
7
|
|
|
|
|
49
|
my $lv = Email::Abstract->get_header($message, 'X-listar-version'); |
53
|
7
|
100
|
|
|
|
695
|
return undef unless defined $lv; |
54
|
1
|
|
|
|
|
2
|
chomp $lv; |
55
|
1
|
|
|
|
|
4
|
my $listname = Email::Abstract->get_header($message, 'X-list'); |
56
|
1
|
50
|
|
|
|
60
|
return undef unless defined $listname; |
57
|
1
|
|
|
|
|
2
|
chomp $listname; |
58
|
1
|
|
|
|
|
9
|
my $l = new Mail::ListDetector::List; |
59
|
1
|
|
|
|
|
4
|
$l->listsoftware($lv); |
60
|
1
|
|
|
|
|
3
|
$l->posting_address($list); |
61
|
1
|
|
|
|
|
3
|
$l->listname($listname); |
62
|
1
|
|
|
|
|
4
|
return $l; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |