| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Sisimai::Lhost::GoogleGroups; |
|
2
|
36
|
|
|
36
|
|
4580
|
use parent 'Sisimai::Lhost'; |
|
|
36
|
|
|
|
|
135
|
|
|
|
36
|
|
|
|
|
365
|
|
|
3
|
36
|
|
|
36
|
|
7048
|
use v5.26; |
|
|
36
|
|
|
|
|
131
|
|
|
4
|
36
|
|
|
36
|
|
201
|
use strict; |
|
|
36
|
|
|
|
|
102
|
|
|
|
36
|
|
|
|
|
1059
|
|
|
5
|
36
|
|
|
36
|
|
195
|
use warnings; |
|
|
36
|
|
|
|
|
134
|
|
|
|
36
|
|
|
|
|
25623
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
1
|
4
|
sub description { 'Google Groups: https://groups.google.com' } |
|
8
|
|
|
|
|
|
|
sub inquire { |
|
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 decode or the arguments are missing |
|
14
|
|
|
|
|
|
|
# @since v4.25.6 |
|
15
|
964
|
|
|
964
|
1
|
4427
|
my $class = shift; |
|
16
|
964
|
|
100
|
|
|
3091
|
my $mhead = shift // return undef; |
|
17
|
963
|
|
100
|
|
|
2877
|
my $mbody = shift // return undef; |
|
18
|
|
|
|
|
|
|
|
|
19
|
962
|
100
|
|
|
|
5960
|
return undef unless index($$mbody, "Google Groups") > -1; |
|
20
|
71
|
50
|
|
|
|
314
|
return undef unless rindex($mhead->{'from'}, '') > -1; |
|
21
|
71
|
50
|
|
|
|
489
|
return undef unless index($mhead->{'subject'}, 'Delivery Status Notification') > -1; |
|
22
|
71
|
50
|
|
|
|
223
|
return undef unless exists $mhead->{'x-failed-recipients'}; |
|
23
|
71
|
50
|
|
|
|
244
|
return undef unless exists $mhead->{'x-google-smtp-source'}; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Hello kijitora@libsisimai.org, |
|
26
|
|
|
|
|
|
|
# |
|
27
|
|
|
|
|
|
|
# We're writing to let you know that the group you tried to contact (group-name) |
|
28
|
|
|
|
|
|
|
# may not exist, or you may not have permission to post messages to the group. |
|
29
|
|
|
|
|
|
|
# A few more details on why you weren't able to post: |
|
30
|
|
|
|
|
|
|
# |
|
31
|
|
|
|
|
|
|
# * You might have spelled or formatted the group name incorrectly. |
|
32
|
|
|
|
|
|
|
# * The owner of the group may have removed this group. |
|
33
|
|
|
|
|
|
|
# * You may need to join the group before receiving permission to post. |
|
34
|
|
|
|
|
|
|
# * This group may not be open to posting. |
|
35
|
|
|
|
|
|
|
# |
|
36
|
|
|
|
|
|
|
# If you have questions related to this or any other Google Group, |
|
37
|
|
|
|
|
|
|
# visit the Help Center at https://groups.google.com/support/. |
|
38
|
|
|
|
|
|
|
# |
|
39
|
|
|
|
|
|
|
# Thanks, |
|
40
|
|
|
|
|
|
|
# |
|
41
|
|
|
|
|
|
|
# Google Groups |
|
42
|
71
|
|
|
|
|
136
|
state $boundaries = ['----- Original message -----', 'Content-Type: message/rfc822']; |
|
43
|
71
|
|
|
|
|
304
|
my $dscontents = [__PACKAGE__->DELIVERYSTATUS]; my $v = $dscontents->[-1]; |
|
|
71
|
|
|
|
|
182
|
|
|
44
|
71
|
|
|
|
|
306
|
my $emailparts = Sisimai::RFC5322->part($mbody, $boundaries); |
|
45
|
71
|
|
|
|
|
151
|
my $recipients = 0; |
|
46
|
71
|
|
|
|
|
350
|
my @entiremesg = split(/\n\n/, $emailparts->[0], 5); pop @entiremesg; |
|
|
71
|
|
|
|
|
140
|
|
|
47
|
71
|
|
|
|
|
320
|
my $issuedcode = join(' ', @entiremesg); $issuedcode =~ y/\n/ /; |
|
|
71
|
|
|
|
|
266
|
|
|
48
|
71
|
|
50
|
|
|
264
|
my $receivedby = $mhead->{'received'} || []; |
|
49
|
71
|
|
|
|
|
333
|
my $recordwide = { |
|
50
|
|
|
|
|
|
|
'rhost' => Sisimai::RFC5322->received($receivedby->[0])->[1], |
|
51
|
|
|
|
|
|
|
'reason' => 'onhold', |
|
52
|
|
|
|
|
|
|
'diagnosis' => Sisimai::String->sweep($issuedcode), |
|
53
|
|
|
|
|
|
|
}; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# * You might have spelled or formatted the group name incorrectly. |
|
56
|
|
|
|
|
|
|
# * The owner of the group may have removed this group. |
|
57
|
|
|
|
|
|
|
# * You may need to join the group before receiving permission to post. |
|
58
|
|
|
|
|
|
|
# * This group may not be open to posting. |
|
59
|
71
|
|
50
|
|
|
1127
|
my $fewdetails = [$emailparts->[0] =~ /^[ ]?[*][ ]?/gm] || []; |
|
60
|
71
|
50
|
|
|
|
366
|
$recordwide->{'reason'} = 'rejected' if scalar @$fewdetails == 4; |
|
61
|
|
|
|
|
|
|
|
|
62
|
71
|
|
|
|
|
297
|
for my $e ( split(',', $mhead->{'x-failed-recipients'}) ) { |
|
63
|
|
|
|
|
|
|
# X-Failed-Recipients: neko@example.jp, nyaan@example.org, ... |
|
64
|
71
|
50
|
|
|
|
382
|
next unless Sisimai::Address->is_emailaddress($e); |
|
65
|
|
|
|
|
|
|
|
|
66
|
71
|
50
|
|
|
|
413
|
if( $v->{'recipient'} ) { |
|
67
|
|
|
|
|
|
|
# There are multiple recipient addresses in the message body. |
|
68
|
0
|
|
|
|
|
0
|
push @$dscontents, __PACKAGE__->DELIVERYSTATUS; |
|
69
|
0
|
|
|
|
|
0
|
$v = $dscontents->[-1]; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
71
|
|
|
|
|
374
|
$v->{'recipient'} = Sisimai::Address->s3s4($e); |
|
72
|
71
|
|
|
|
|
143
|
$recipients++; |
|
73
|
71
|
|
|
|
|
541
|
$v->{ $_ } = $recordwide->{ $_ } for keys %$recordwide; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
71
|
50
|
|
|
|
205
|
return undef unless $recipients; |
|
76
|
71
|
|
|
|
|
700
|
return {"ds" => $dscontents, "rfc822" => $emailparts->[1]}; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
|
80
|
|
|
|
|
|
|
__END__ |