line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::ListDetector::Detector::ListSTAR; |
2
|
|
|
|
|
|
|
|
3
|
39
|
|
|
39
|
|
223
|
use strict; |
|
39
|
|
|
|
|
74
|
|
|
39
|
|
|
|
|
1375
|
|
4
|
39
|
|
|
39
|
|
237
|
use warnings; |
|
39
|
|
|
|
|
84
|
|
|
39
|
|
|
|
|
1260
|
|
5
|
|
|
|
|
|
|
|
6
|
39
|
|
|
39
|
|
206
|
use vars qw($VERSION); |
|
39
|
|
|
|
|
95
|
|
|
39
|
|
|
|
|
2204
|
|
7
|
|
|
|
|
|
|
$VERSION = '0.01'; |
8
|
|
|
|
|
|
|
|
9
|
39
|
|
|
39
|
|
272
|
use base qw(Mail::ListDetector::Detector::Base); |
|
39
|
|
|
|
|
76
|
|
|
39
|
|
|
|
|
3048
|
|
10
|
39
|
|
|
39
|
|
236
|
use Mail::ListDetector::List; |
|
39
|
|
|
|
|
80
|
|
|
39
|
|
|
|
|
895
|
|
11
|
39
|
|
|
39
|
|
255
|
use Mail::ListDetector::Detector::RFC2369; |
|
39
|
|
|
|
|
90
|
|
|
39
|
|
|
|
|
960
|
|
12
|
39
|
|
|
39
|
|
186
|
use Carp; |
|
39
|
|
|
|
|
69
|
|
|
39
|
|
|
|
|
5573
|
|
13
|
|
|
|
|
|
|
|
14
|
24
|
|
|
24
|
0
|
114
|
sub DEBUG { 0 } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub match { |
17
|
24
|
|
|
24
|
1
|
60
|
my $self = shift; |
18
|
24
|
|
|
|
|
57
|
my $message = shift; |
19
|
24
|
50
|
|
|
|
98
|
print "Got message $message\n" if DEBUG; |
20
|
24
|
50
|
|
|
|
233
|
carp ("Mail::ListDetector::Detector::ListSTAR - no message supplied") unless defined($message); |
21
|
39
|
|
|
39
|
|
269
|
use Email::Abstract; |
|
39
|
|
|
|
|
78
|
|
|
39
|
|
|
|
|
24121
|
|
22
|
|
|
|
|
|
|
|
23
|
24
|
|
|
|
|
212
|
my $x_listserver = Email::Abstract->get_header($message, 'X-Listserver'); |
24
|
24
|
|
|
|
|
1577
|
my $x_list_software = Email::Abstract->get_header($message, 'X-List-Software'); |
25
|
24
|
|
|
|
|
1880
|
my $list_software = Email::Abstract->get_header($message, 'List-Software'); |
26
|
24
|
|
|
|
|
1469
|
my $listsoftware; |
27
|
24
|
100
|
100
|
|
|
343
|
if (defined($x_listserver) && ($x_listserver =~ m/(ListSTAR v[\w\.]+)/)) { |
|
|
100
|
100
|
|
|
|
|
|
|
100
|
66
|
|
|
|
|
28
|
2
|
|
|
|
|
10
|
$listsoftware = $1; |
29
|
|
|
|
|
|
|
} elsif (defined($list_software) && ($list_software =~ m/(ListSTAR v[\w\.]+)/)) { |
30
|
1
|
|
|
|
|
3
|
$listsoftware = $1; |
31
|
|
|
|
|
|
|
} elsif (defined($x_list_software) && ($x_list_software =~ m/(ListSTAR v[\w\.]+)/)) { |
32
|
1
|
|
|
|
|
3
|
$listsoftware = $1; |
33
|
|
|
|
|
|
|
} else { |
34
|
20
|
|
|
|
|
268
|
return undef; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
4
|
|
|
|
|
8
|
my $listname; |
38
|
4
|
|
|
|
|
24
|
my $sender = Email::Abstract->get_header($message, 'Sender'); |
39
|
4
|
100
|
66
|
|
|
478
|
if (defined($sender) && ($sender =~ m/<(.*)@.*>/)) { |
40
|
2
|
|
|
|
|
6
|
$listname = $1; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
4
|
|
|
|
|
52
|
my $rfc2369 = new Mail::ListDetector::Detector::RFC2369 |
44
|
|
|
|
|
|
|
my $list; |
45
|
4
|
100
|
|
|
|
38
|
unless ($list = $rfc2369->match($message)) { |
46
|
2
|
|
|
|
|
8
|
my $x_list_subscribe = Email::Abstract->get_header($message, 'X-List-Subscribe'); |
47
|
|
|
|
|
|
|
|
48
|
2
|
50
|
|
|
|
162
|
return undef unless defined($x_list_subscribe); |
49
|
2
|
|
|
|
|
6
|
chomp $x_list_subscribe; |
50
|
2
|
50
|
|
|
|
20
|
return undef unless $x_list_subscribe =~ m/(<.*>)/; |
51
|
2
|
|
|
|
|
21
|
my $list_uri = new URI($1); |
52
|
2
|
50
|
|
|
|
8295
|
return undef unless defined $list_uri; |
53
|
2
|
50
|
|
|
|
22
|
if ($list_uri->scheme ne 'mailto') { |
54
|
0
|
|
|
|
|
0
|
return undef; |
55
|
|
|
|
|
|
|
} |
56
|
2
|
|
|
|
|
301
|
my $posting_address = $list_uri->to; |
57
|
2
|
|
|
|
|
400
|
my $listname; |
58
|
2
|
50
|
|
|
|
17
|
if($posting_address =~ m/^(.*)@.*$/) { |
59
|
2
|
|
|
|
|
7
|
$listname = $1; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
2
|
|
|
|
|
26
|
$list = new Mail::ListDetector::List; |
63
|
2
|
|
|
|
|
12
|
$list->listname($listname); |
64
|
2
|
|
|
|
|
11
|
$list->posting_address($posting_address); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
4
|
100
|
|
|
|
19
|
if (defined($listname)) { |
68
|
2
|
|
|
|
|
8
|
$list->listname($listname); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
4
|
|
|
|
|
19
|
$list->listsoftware($listsoftware); |
72
|
4
|
|
|
|
|
68
|
return $list; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |