line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Sisimai::Lhost::GoogleGroups; |
2
|
22
|
|
|
22
|
|
6153
|
use parent 'Sisimai::Lhost'; |
|
22
|
|
|
|
|
47
|
|
|
22
|
|
|
|
|
149
|
|
3
|
22
|
|
|
22
|
|
1339
|
use feature ':5.10'; |
|
22
|
|
|
|
|
41
|
|
|
22
|
|
|
|
|
1521
|
|
4
|
22
|
|
|
22
|
|
126
|
use strict; |
|
22
|
|
|
|
|
36
|
|
|
22
|
|
|
|
|
469
|
|
5
|
22
|
|
|
22
|
|
119
|
use warnings; |
|
22
|
|
|
|
|
46
|
|
|
22
|
|
|
|
|
12538
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
1
|
1148
|
sub description { 'Google Groups: https://groups.google.com' } |
8
|
|
|
|
|
|
|
sub make { |
9
|
|
|
|
|
|
|
# Detect an error from Google Groups |
10
|
|
|
|
|
|
|
# @param [Hash] mhead Message headers of a bounce email |
11
|
|
|
|
|
|
|
# @param [String] mbody Message body of a bounce email |
12
|
|
|
|
|
|
|
# @return [Hash] Bounce data list and message/rfc822 part |
13
|
|
|
|
|
|
|
# @return [Undef] failed to parse or the arguments are missing |
14
|
|
|
|
|
|
|
# @since v4.25.6 |
15
|
567
|
|
|
567
|
1
|
1332
|
my $class = shift; |
16
|
567
|
|
100
|
|
|
1536
|
my $mhead = shift // return undef; |
17
|
566
|
|
50
|
|
|
1311
|
my $mbody = shift // return undef; |
18
|
|
|
|
|
|
|
|
19
|
566
|
100
|
|
|
|
1914
|
return undef unless rindex($mhead->{'from'}, '') > -1; |
20
|
148
|
50
|
|
|
|
605
|
return undef unless index($mhead->{'subject'}, 'Delivery Status Notification') > -1; |
21
|
148
|
100
|
|
|
|
438
|
return undef unless exists $mhead->{'x-failed-recipients'}; |
22
|
128
|
100
|
|
|
|
460
|
return undef unless exists $mhead->{'x-google-smtp-source'}; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Hello kijitora@libsisimai.org, |
25
|
|
|
|
|
|
|
# |
26
|
|
|
|
|
|
|
# We're writing to let you know that the group you tried to contact (group-name) |
27
|
|
|
|
|
|
|
# may not exist, or you may not have permission to post messages to the group. |
28
|
|
|
|
|
|
|
# A few more details on why you weren't able to post: |
29
|
|
|
|
|
|
|
# |
30
|
|
|
|
|
|
|
# * You might have spelled or formatted the group name incorrectly. |
31
|
|
|
|
|
|
|
# * The owner of the group may have removed this group. |
32
|
|
|
|
|
|
|
# * You may need to join the group before receiving permission to post. |
33
|
|
|
|
|
|
|
# * This group may not be open to posting. |
34
|
|
|
|
|
|
|
# |
35
|
|
|
|
|
|
|
# If you have questions related to this or any other Google Group, |
36
|
|
|
|
|
|
|
# visit the Help Center at https://groups.google.com/support/. |
37
|
|
|
|
|
|
|
# |
38
|
|
|
|
|
|
|
# Thanks, |
39
|
|
|
|
|
|
|
# |
40
|
|
|
|
|
|
|
# Google Groups |
41
|
72
|
|
|
|
|
136
|
state $indicators = __PACKAGE__->INDICATORS; |
42
|
72
|
|
|
|
|
137
|
state $rebackbone = qr/^-----[ ]Original[ ]message[ ]-----$/m; |
43
|
|
|
|
|
|
|
|
44
|
72
|
|
|
|
|
211
|
my $dscontents = [__PACKAGE__->DELIVERYSTATUS]; |
45
|
72
|
|
|
|
|
295
|
my $emailsteak = Sisimai::RFC5322->fillet($mbody, $rebackbone); |
46
|
72
|
|
|
|
|
371
|
my $recordwide = { 'rhost' => '', 'reason' => '', 'diagnosis' => '' }; |
47
|
72
|
|
|
|
|
125
|
my $recipients = 0; |
48
|
72
|
|
|
|
|
149
|
my $v = $dscontents->[-1]; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# * You might have spelled or formatted the group name incorrectly. |
51
|
|
|
|
|
|
|
# * The owner of the group may have removed this group. |
52
|
|
|
|
|
|
|
# * You may need to join the group before receiving permission to post. |
53
|
|
|
|
|
|
|
# * This group may not be open to posting. |
54
|
72
|
|
50
|
|
|
751
|
my $fewdetails = [$emailsteak->[0] =~ /^[ ]?[*][ ]?/gm] || []; |
55
|
72
|
50
|
|
|
|
333
|
$recordwide->{'reason'} = scalar @$fewdetails == 4 ? 'rejected' : 'onhold'; |
56
|
|
|
|
|
|
|
|
57
|
72
|
|
|
|
|
390
|
my @entiremesg = split(/\n\n/, $emailsteak->[0], 5); pop @entiremesg; |
|
72
|
|
|
|
|
169
|
|
58
|
72
|
|
|
|
|
369
|
my $diagnostic = join(' ', @entiremesg); $diagnostic =~ y/\n/ /; |
|
72
|
|
|
|
|
221
|
|
59
|
72
|
|
|
|
|
439
|
$recordwide->{'diagnosis'} = Sisimai::String->sweep($diagnostic); |
60
|
|
|
|
|
|
|
|
61
|
72
|
|
|
|
|
308
|
my $serverlist = Sisimai::RFC5322->received($mhead->{'received'}->[0]); |
62
|
72
|
|
|
|
|
207
|
$recordwide->{'rhost'} = shift @$serverlist; |
63
|
|
|
|
|
|
|
|
64
|
72
|
|
|
|
|
324
|
for my $e ( split(',', $mhead->{'x-failed-recipients'}) ) { |
65
|
|
|
|
|
|
|
# X-Failed-Recipients: neko@example.jp, nyaan@example.org, ... |
66
|
72
|
50
|
|
|
|
302
|
next unless Sisimai::RFC5322->is_emailaddress($e); |
67
|
|
|
|
|
|
|
|
68
|
72
|
50
|
|
|
|
297
|
if( $v->{'recipient'} ) { |
69
|
|
|
|
|
|
|
# There are multiple recipient addresses in the message body. |
70
|
0
|
|
|
|
|
0
|
push @$dscontents, __PACKAGE__->DELIVERYSTATUS; |
71
|
0
|
|
|
|
|
0
|
$v = $dscontents->[-1]; |
72
|
|
|
|
|
|
|
} |
73
|
72
|
|
|
|
|
391
|
$v->{'recipient'} = Sisimai::Address->s3s4($e); |
74
|
72
|
|
|
|
|
129
|
$recipients++; |
75
|
72
|
|
|
|
|
460
|
$v->{ $_ } = $recordwide->{ $_ } for keys %$recordwide; |
76
|
|
|
|
|
|
|
} |
77
|
72
|
50
|
|
|
|
173
|
return undef unless $recipients; |
78
|
72
|
|
|
|
|
505
|
return { 'ds' => $dscontents, 'rfc822' => $emailsteak->[1] }; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
__END__ |