line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::ListDetector::Detector::Majordomo; |
2
|
|
|
|
|
|
|
|
3
|
39
|
|
|
39
|
|
236
|
use strict; |
|
39
|
|
|
|
|
228
|
|
|
39
|
|
|
|
|
1499
|
|
4
|
39
|
|
|
39
|
|
217
|
use warnings; |
|
39
|
|
|
|
|
306
|
|
|
39
|
|
|
|
|
1488
|
|
5
|
|
|
|
|
|
|
|
6
|
39
|
|
|
39
|
|
299
|
use base qw(Mail::ListDetector::Detector::Base); |
|
39
|
|
|
|
|
157
|
|
|
39
|
|
|
|
|
3372
|
|
7
|
39
|
|
|
39
|
|
595
|
use Mail::ListDetector::List; |
|
39
|
|
|
|
|
11063
|
|
|
39
|
|
|
|
|
2023
|
|
8
|
39
|
|
|
39
|
|
1045
|
use Email::Valid; |
|
39
|
|
|
|
|
367
|
|
|
39
|
|
|
|
|
835
|
|
9
|
39
|
|
|
39
|
|
1234
|
use Carp; |
|
39
|
|
|
|
|
70
|
|
|
39
|
|
|
|
|
14916
|
|
10
|
|
|
|
|
|
|
|
11
|
47
|
|
|
47
|
0
|
180
|
sub DEBUG { 0 } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub match { |
14
|
7
|
|
|
7
|
1
|
15
|
my $self = shift; |
15
|
7
|
|
|
|
|
16
|
my $message = shift; |
16
|
7
|
50
|
|
|
|
28
|
print "Got message $message\n" if DEBUG; |
17
|
7
|
50
|
|
|
|
25
|
carp ("Mail::ListDetector::Detector::Majordomo - no message supplied") unless defined($message); |
18
|
39
|
|
|
39
|
|
235
|
use Email::Abstract; |
|
39
|
|
|
|
|
79
|
|
|
39
|
|
|
|
|
28527
|
|
19
|
|
|
|
|
|
|
|
20
|
7
|
|
|
|
|
37
|
my $sender = Email::Abstract->get_header($message, 'Sender'); |
21
|
7
|
50
|
|
|
|
592
|
print "Got sender\n" if DEBUG; |
22
|
7
|
100
|
|
|
|
36
|
return unless defined $sender; |
23
|
6
|
50
|
|
|
|
38
|
print "Sender was defined\n" if DEBUG; |
24
|
6
|
|
|
|
|
16
|
chomp $sender; |
25
|
6
|
50
|
|
|
|
21
|
print "Sender is [$sender]\n" if DEBUG; |
26
|
|
|
|
|
|
|
|
27
|
6
|
|
|
|
|
29
|
my ($list) = ($sender =~ /^owner-(\S+)$/); |
28
|
6
|
100
|
|
|
|
29
|
if (!(defined $list)) { |
29
|
4
|
50
|
|
|
|
14
|
print "Sender didn't match owner-, trying -owner\n" if DEBUG; |
30
|
4
|
100
|
|
|
|
22
|
if ($sender =~ /^(\S+?)-owner/) { |
31
|
1
|
50
|
|
|
|
9
|
print "Sender matched -owner, removing\n" if DEBUG; |
32
|
1
|
|
|
|
|
3
|
$list = $sender; |
33
|
1
|
|
|
|
|
6
|
$list =~ s/-owner@/@/; |
34
|
|
|
|
|
|
|
} else { |
35
|
3
|
50
|
|
|
|
8
|
print "Sender didn't match second owner form\n" if DEBUG; |
36
|
3
|
|
|
|
|
47
|
return undef; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
3
|
50
|
|
|
|
14
|
return unless defined $list; |
40
|
3
|
|
|
|
|
7
|
chomp $list; |
41
|
3
|
50
|
|
|
|
8
|
print "Got list [$list]\n" if DEBUG; |
42
|
3
|
100
|
|
|
|
26
|
if ($list =~ m/(majordomo?|domo)\@/) { |
43
|
1
|
|
|
|
|
12
|
return undef; |
44
|
|
|
|
|
|
|
} |
45
|
2
|
50
|
|
|
|
17
|
return unless Email::Valid->address($list); |
46
|
2
|
50
|
|
|
|
4859
|
print "List is valid email\n" if DEBUG; |
47
|
|
|
|
|
|
|
|
48
|
2
|
|
|
|
|
6
|
my $mv; |
49
|
|
|
|
|
|
|
# Some versions of Majordomo provide a version number |
50
|
2
|
50
|
|
|
|
16
|
unless ($mv = Email::Abstract->get_header($message, 'X-Majordomo-Version')) { |
51
|
|
|
|
|
|
|
# If we don't have a version number check the received headers. |
52
|
2
|
|
|
|
|
446
|
my (@received) = Email::Abstract->get_header($message, 'Received'); |
53
|
2
|
|
|
|
|
267
|
my $majordom = 0; |
54
|
2
|
|
|
|
|
7
|
foreach my $received_line (@received) { |
55
|
3
|
100
|
|
|
|
22
|
if ($received_line =~ /(majordomo?|domo)\@/) { |
56
|
2
|
|
|
|
|
5
|
$majordom++; |
57
|
2
|
|
|
|
|
6
|
last; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
2
|
50
|
|
|
|
7
|
print "Received check returned [$majordom]\n" if DEBUG; |
61
|
2
|
50
|
|
|
|
32
|
return unless $majordom; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
2
|
50
|
|
|
|
9
|
print "On list\n" if DEBUG; |
65
|
2
|
|
|
|
|
27
|
my $l = new Mail::ListDetector::List; |
66
|
2
|
50
|
|
|
|
9
|
if ($mv) { |
67
|
0
|
|
|
|
|
0
|
$l->listsoftware("majordomo $mv"); |
68
|
|
|
|
|
|
|
} else { |
69
|
2
|
|
|
|
|
77
|
$l->listsoftware('majordomo'); |
70
|
|
|
|
|
|
|
} |
71
|
2
|
|
|
|
|
19
|
$l->posting_address($list); |
72
|
2
|
50
|
|
|
|
10
|
print "Set listsoftware 'majordomo', posting address [$list]\n" if DEBUG; |
73
|
2
|
|
|
|
|
16
|
my ($listname) = ($list =~ /^([^@]+)@/); |
74
|
2
|
50
|
|
|
|
7
|
print "Listname is [$listname]\n" if DEBUG; |
75
|
2
|
|
|
|
|
11
|
$l->listname($listname); |
76
|
2
|
|
|
|
|
14
|
return $l; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |