File Coverage

lib/Sisimai/Reason/Suspend.pm
Criterion Covered Total %
statement 23 23 100.0
branch 7 8 87.5
condition 3 4 75.0
subroutine 7 7 100.0
pod 2 4 50.0
total 42 46 91.3


line stmt bran cond sub pod time code
1             package Sisimai::Reason::Suspend;
2 59     59   1243 use feature ':5.10';
  59         102  
  59         4118  
3 59     59   314 use strict;
  59         99  
  59         1183  
4 59     59   263 use warnings;
  59         925  
  59         15397  
5              
6 18     18 1 679 sub text { 'suspend' }
7 4     4 0 14 sub description { 'Email rejected due to a recipient account is being suspended' }
8             sub match {
9             # Try to match that the given text and regular expressions
10             # @param [String] argv1 String to be matched with regular expressions
11             # @return [Integer] 0: Did not match
12             # 1: Matched
13             # @since v4.0.0
14 1888     1888 1 8359 my $class = shift;
15 1888   50     3901 my $argv1 = shift // return undef;
16              
17 1888         2314 state $index = [
18             ' is currently suspended',
19             ' temporary locked',
20             'boite du destinataire archivee',
21             'email account that you tried to reach is disabled',
22             'has been suspended',
23             'invalid/inactive user',
24             'is a deactivated mailbox', # http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=20022&&no=1000742
25             'mailbox currently suspended',
26             'mailbox is frozen',
27             'mailbox unavailable or access denied',
28             'recipient rejected: temporarily inactive',
29             'recipient suspend the service',
30             'this account has been disabled or discontinued',
31             'this mailbox is disabled',
32             'user suspended', # http://mail.163.com/help/help_spam_16.htm
33             'vdelivermail: account is locked email bounced',
34             ];
35 1888 100       2873 return 1 if grep { rindex($argv1, $_) > -1 } @$index;
  30208         47494  
36 1860         4178 return 0;
37             }
38              
39             sub true {
40             # The envelope recipient's mailbox is suspended or not
41             # @param [Sisimai::Data] argvs Object to be detected the reason
42             # @return [Integer] 1: is mailbox suspended
43             # 0: is not suspended
44             # @since v4.0.0
45             # @see http://www.ietf.org/rfc/rfc2822.txt
46 1799     1799 0 2726 my $class = shift;
47 1799   100     3704 my $argvs = shift // return undef;
48 1798 100       4483 return undef unless $argvs->deliverystatus;
49              
50 1403 50       6933 return 1 if $argvs->reason eq 'suspend';
51 1403 100       6212 return 1 if __PACKAGE__->match(lc $argvs->diagnosticcode);
52 1388         3755 return 0
53             }
54              
55             1;
56             __END__