sisimai 4.22.1 → 4.22.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sisimai might be problematic. Click here for more details.

Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog.md +21 -0
  3. data/README-JA.md +2 -2
  4. data/README.md +2 -2
  5. data/lib/sisimai.rb +2 -3
  6. data/lib/sisimai/address.rb +20 -40
  7. data/lib/sisimai/arf.rb +4 -4
  8. data/lib/sisimai/bite.rb +1 -0
  9. data/lib/sisimai/bite/email.rb +3 -4
  10. data/lib/sisimai/bite/email/activehunter.rb +7 -7
  11. data/lib/sisimai/bite/email/amazonses.rb +14 -14
  12. data/lib/sisimai/bite/email/amazonworkmail.rb +7 -7
  13. data/lib/sisimai/bite/email/aol.rb +8 -8
  14. data/lib/sisimai/bite/email/apachejames.rb +7 -7
  15. data/lib/sisimai/bite/email/bigfoot.rb +7 -7
  16. data/lib/sisimai/bite/email/biglobe.rb +7 -7
  17. data/lib/sisimai/bite/email/courier.rb +9 -9
  18. data/lib/sisimai/bite/email/domino.rb +8 -8
  19. data/lib/sisimai/bite/email/einsundeins.rb +7 -7
  20. data/lib/sisimai/bite/email/exchange2003.rb +10 -10
  21. data/lib/sisimai/bite/email/exchange2007.rb +10 -10
  22. data/lib/sisimai/bite/email/exim.rb +18 -19
  23. data/lib/sisimai/bite/email/ezweb.rb +9 -11
  24. data/lib/sisimai/bite/email/facebook.rb +22 -23
  25. data/lib/sisimai/bite/email/gmx.rb +7 -7
  26. data/lib/sisimai/bite/email/google.rb +22 -25
  27. data/lib/sisimai/bite/email/gsuite.rb +17 -19
  28. data/lib/sisimai/bite/email/imailserver.rb +13 -13
  29. data/lib/sisimai/bite/email/interscanmss.rb +7 -7
  30. data/lib/sisimai/bite/email/kddi.rb +7 -7
  31. data/lib/sisimai/bite/email/mailfoundry.rb +6 -6
  32. data/lib/sisimai/bite/email/mailmarshalsmtp.rb +13 -13
  33. data/lib/sisimai/bite/email/mailru.rb +10 -10
  34. data/lib/sisimai/bite/email/mcafee.rb +7 -7
  35. data/lib/sisimai/bite/email/messagelabs.rb +9 -9
  36. data/lib/sisimai/bite/email/messagingserver.rb +8 -8
  37. data/lib/sisimai/bite/email/mfilter.rb +7 -7
  38. data/lib/sisimai/bite/email/mxlogic.rb +9 -9
  39. data/lib/sisimai/bite/email/notes.rb +12 -12
  40. data/lib/sisimai/bite/email/office365.rb +14 -15
  41. data/lib/sisimai/bite/email/opensmtpd.rb +7 -7
  42. data/lib/sisimai/bite/email/outlook.rb +9 -9
  43. data/lib/sisimai/bite/email/postfix.rb +13 -13
  44. data/lib/sisimai/bite/email/qmail.rb +9 -9
  45. data/lib/sisimai/bite/email/receivingses.rb +9 -9
  46. data/lib/sisimai/bite/email/sendgrid.rb +9 -9
  47. data/lib/sisimai/bite/email/sendmail.rb +7 -7
  48. data/lib/sisimai/bite/email/surfcontrol.rb +7 -7
  49. data/lib/sisimai/bite/email/userdefined.rb +7 -7
  50. data/lib/sisimai/bite/email/v5sendmail.rb +21 -22
  51. data/lib/sisimai/bite/email/verizon.rb +8 -8
  52. data/lib/sisimai/bite/email/x1.rb +6 -6
  53. data/lib/sisimai/bite/email/x2.rb +6 -6
  54. data/lib/sisimai/bite/email/x3.rb +6 -6
  55. data/lib/sisimai/bite/email/x4.rb +9 -9
  56. data/lib/sisimai/bite/email/x5.rb +6 -6
  57. data/lib/sisimai/bite/email/yahoo.rb +7 -7
  58. data/lib/sisimai/bite/email/yandex.rb +7 -7
  59. data/lib/sisimai/bite/email/zoho.rb +8 -8
  60. data/lib/sisimai/bite/json.rb +10 -11
  61. data/lib/sisimai/bite/json/amazonses.rb +11 -11
  62. data/lib/sisimai/bite/json/sendgrid.rb +67 -17
  63. data/lib/sisimai/data.rb +19 -21
  64. data/lib/sisimai/data/json.rb +3 -3
  65. data/lib/sisimai/data/yaml.rb +3 -3
  66. data/lib/sisimai/datetime.rb +18 -21
  67. data/lib/sisimai/mail.rb +1 -1
  68. data/lib/sisimai/mail/stdin.rb +2 -2
  69. data/lib/sisimai/mda.rb +4 -4
  70. data/lib/sisimai/message.rb +1 -1
  71. data/lib/sisimai/message/email.rb +32 -35
  72. data/lib/sisimai/message/json.rb +3 -3
  73. data/lib/sisimai/mime.rb +5 -6
  74. data/lib/sisimai/order/email.rb +11 -11
  75. data/lib/sisimai/order/json.rb +3 -3
  76. data/lib/sisimai/reason.rb +2 -2
  77. data/lib/sisimai/reason/userunknown.rb +4 -5
  78. data/lib/sisimai/rfc3464.rb +14 -16
  79. data/lib/sisimai/rfc3834.rb +5 -5
  80. data/lib/sisimai/rfc5322.rb +2 -2
  81. data/lib/sisimai/rhost.rb +6 -5
  82. data/lib/sisimai/rhost/exchangeonline.rb +1 -1
  83. data/lib/sisimai/rhost/godaddy.rb +87 -0
  84. data/lib/sisimai/rhost/googleapps.rb +1 -1
  85. data/lib/sisimai/smtp/error.rb +21 -27
  86. data/lib/sisimai/smtp/status.rb +2 -2
  87. data/lib/sisimai/string.rb +7 -7
  88. data/lib/sisimai/version.rb +1 -1
  89. data/set-of-emails/jsonobj/json-sendgrid-12.json +1 -0
  90. data/set-of-emails/jsonobj/json-sendgrid-13.json +1 -0
  91. data/set-of-emails/jsonobj/json-sendgrid-14.json +1 -0
  92. data/set-of-emails/jsonobj/json-sendgrid-15.json +1 -0
  93. data/set-of-emails/jsonobj/json-sendgrid-16.json +1 -0
  94. data/set-of-emails/jsonobj/json-sendgrid-17.json +1 -0
  95. data/set-of-emails/maildir/bsd/rhost-godaddy-01.eml +83 -0
  96. data/set-of-emails/maildir/bsd/rhost-godaddy-02.eml +69 -0
  97. metadata +12 -6
  98. data/lib/sisimai/ced.rb +0 -48
  99. data/lib/sisimai/msp.rb +0 -39
  100. data/lib/sisimai/mta.rb +0 -39
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c644b2582fd163b4227e472c750409fff659c691
4
- data.tar.gz: 39c38f411e6411a77f907d96877c808a8f731879
3
+ metadata.gz: 0ca3f22af3e372dd9c1d741bca61752dc92bdeaf
4
+ data.tar.gz: bf25002aabb9a2926ca13631022b06b6331271f9
5
5
  SHA512:
6
- metadata.gz: 8d08ac534acade16e7aedd5ef71bd12bd44702b51283833a874e1f178f4e3e5e7e6bab3f8544e0e1254e686f8c4455e15b397bbd05a89a2aba343202013a818e
7
- data.tar.gz: 2302808a843715d2a463256abde74c8dd208b277d4325941b39e64ad87f429252e65f794e7a30fd8a924e2d665b77e7026088cbd974a9fcfc29b61f67c5e45be
6
+ metadata.gz: 440afa6405f3c4b7e0faa47c958733e755f8400dd9666b3e324dedea6b8d01d506be83b3115332fc1b0ac8f83bab029a68f13ee7c2969df2392a90af0338d960
7
+ data.tar.gz: 44effc61e68e42a4dc9a1f71c95daacaf61d5e6f0904cf57b0b1a405621fd5fafeca99195f76c88398974093d74a038e5243ecbaf6718d143b4f8650fd61966c
data/ChangeLog.md CHANGED
@@ -3,6 +3,27 @@ RELEASE NOTES for Ruby version of Sisimai
3
3
  - releases: "https://github.com/sisimai/rb-Sisimai/releases"
4
4
  - download: "https://rubygems.org/gems/sisimai"
5
5
 
6
+ v4.22.2
7
+ --------------------------------------------------------------------------------
8
+ - release: "Fri, 13 Oct 2017 11:59:53 +0900 (JST)"
9
+ - version: "v4.22.2"
10
+ - changes:
11
+ - Apply Pull-Request #84 (issue #83) for setting the value of `softorhard` in
12
+ `Sisimai::SMTP::Error.soft_or_hard` method. Thanks to @lunatyq.
13
+ - Fix a wrong value assingment, and code for Performance/StartWith reported
14
+ from Rubocop in Sisimai::Bite::Email::GSuite.
15
+ - Update codes about Lint/AssignmentInCondition, Style/Next, Style/EmptyElse,
16
+ Style/UselessAssignment, and others reported from Rubocop.
17
+ - Fix code for Performance/Casecmp, Performance/LstripRstrip in Sisimai::MIME.
18
+ - Update code for Style/SymbolProc in Sisimai::Message::Email.
19
+ - Support parsing JSON object from SendGrid Event Webhook.
20
+ - Suuport "event": "spamreport" via Feedback Loop on SendGrid Event Webhook.
21
+ - Implement `Sisimai::Address.is_undisclosed` method.
22
+ - Import Pull-Request #237: Support parsing bounce mail from GoDaddy.
23
+ - Fix bug for setting the value of `date` in Sisimai::Bite::Email::Postfix.
24
+ - Remove obsoleted classes: Sisimai::MTA, Sisimai::MSP, and Sisimai::CED.
25
+ - Remove obsoleted method: `Sisimai::Address.parse`.
26
+
6
27
  v4.22.1
7
28
  --------------------------------------------------------------------------------
8
29
  - release: "Tue, 29 Aug 2017 17:25:22 +0900 (JST)"
data/README-JA.md CHANGED
@@ -239,8 +239,8 @@ Differences between Ruby version and Perl version
239
239
  | メール解析速度(1000通のメール) | 3.30秒 | 2.33秒 |
240
240
  | インストール方法 | gem install | cpanm, cpm |
241
241
  | 依存モジュール数(コアモジュールを除く) | 1モジュール | 2モジュール |
242
- | LOC:ソースコードの行数 | 12600行 | 9300行 |
243
- | テスト件数(spec/,t/,xt/ディレクトリ) | 196800件 | 204600件 |
242
+ | LOC:ソースコードの行数 | 12600行 | 9400行 |
243
+ | テスト件数(spec/,t/,xt/ディレクトリ) | 197300件 | 205200件 |
244
244
  | ライセンス | 二条項BSD | 二条項BSD |
245
245
  | 開発会社によるサポート契約 | 準備中 | 提供中 |
246
246
 
data/README.md CHANGED
@@ -243,8 +243,8 @@ and bounceHammer are available at
243
243
  | The speed of parsing email(1000 emails) | 3.30s | 2.33s |
244
244
  | How to install | gem install | cpanm, cpm |
245
245
  | Dependencies (Except core modules) | 1 module | 2 modules |
246
- | LOC:Source lines of code | 12600 lines | 9300 lines |
247
- | The number of tests(spec/,t/,xt/) directory | 196800 tests | 204600 tests |
246
+ | LOC:Source lines of code | 12600 lines | 9400 lines |
247
+ | The number of tests(spec/,t/,xt/) directory | 197300 tests | 205200 tests |
248
248
  | License | BSD 2-Clause | BSD 2-Clause |
249
249
  | Support Contract provided by Developer | Coming soon | Available |
250
250
 
data/lib/sisimai.rb CHANGED
@@ -32,8 +32,7 @@ module Sisimai
32
32
  rtype = nil
33
33
  input = argv1[:input] || nil
34
34
  field = argv1[:field] || []
35
- fail ' ***error: "field" accepts an array reference only' unless field.is_a? Array
36
-
35
+ raise ' ***error: "field" accepts an array reference only' unless field.is_a? Array
37
36
 
38
37
  unless input
39
38
  # "input" did not specified, try to detect automatically.
@@ -100,7 +99,7 @@ module Sisimai
100
99
 
101
100
  else
102
101
  # The value of "input" neither "email" nor "json"
103
- fail ' ***error: invalid value of "input"'
102
+ raise ' ***error: invalid value of "input"'
104
103
  end
105
104
 
106
105
  return nil if bouncedata.size.zero?
@@ -3,22 +3,23 @@ module Sisimai
3
3
  class Address
4
4
  # Imported from p5-Sisimail/lib/Sisimai/Address.pm
5
5
  require 'sisimai/rfc5322'
6
+ @@undisclosed = 'libsisimai.org.invalid'
6
7
 
7
8
  # Return pseudo recipient or sender address
8
9
  # @param [Symbol] argv1 Address type: :r or :s
9
10
  # @return [String, Nil] Pseudo recipient address or sender address or
10
- # Undef when the $argv1 is neither :r nor :s
11
+ # nil when the argv1 is neither :r nor :s
11
12
  def self.undisclosed(argv1)
12
13
  return nil unless argv1
13
14
  return nil unless %w|r s|.index(argv1.to_s)
14
15
 
15
16
  local = argv1 == :r ? 'recipient' : 'sender'
16
- return sprintf('undisclosed-%s-in-headers@libsisimai.org.invalid', local)
17
+ return sprintf('undisclosed-%s-in-headers@%s', local, @@undisclosed)
17
18
  end
18
19
 
19
20
  # New constructor of Sisimai::Address
20
21
  # @param [Hash] argvs Email address, name, and other elements
21
- # @return [Sisimai::Address] Object or Undef when the email address was
22
+ # @return [Sisimai::Address] Object or nil when the email address was
22
23
  # not valid.
23
24
  # @example make({address: 'neko@example.org', name: 'Neko', comment: '(nyaan)')}
24
25
  # # => Sisimai::Address object
@@ -42,7 +43,7 @@ module Sisimai
42
43
  # @param [String] argv1 String including email address
43
44
  # @param [Boolean] addrs true: Returns list including all the elements
44
45
  # false: Returns list including email addresses only
45
- # @return [Array, Nil] Email address list or Undef when there is no
46
+ # @return [Array, Nil] Email address list or nil when there is no
46
47
  # email address in the argument
47
48
  # @example Parse email address
48
49
  # find('Neko <neko(nyaan)@example.org>')
@@ -212,7 +213,7 @@ module Sisimai
212
213
  end
213
214
  end
214
215
  next
215
- end # End of if('"')
216
+ end # End of if('"')
216
217
  else
217
218
  # The character is not a delimiter
218
219
  p.size > 0 ? (v[p] += e) : (v[:name] += e)
@@ -227,7 +228,7 @@ module Sisimai
227
228
  # No email address like <neko@example.org> in the argument
228
229
  if cv = v[:name].match(validemail)
229
230
  # String like an email address will be set to the value of "address"
230
- v[:address] = sprintf("%s@%s", cv[1], cv[2])
231
+ v[:address] = sprintf('%s@%s', cv[1], cv[2])
231
232
 
232
233
  elsif Sisimai::RFC5322.is_mailerdaemon(v[:name])
233
234
  # Allow if the argument is MAILER-DAEMON
@@ -290,36 +291,6 @@ module Sisimai
290
291
  return addrtables
291
292
  end
292
293
 
293
- # Email address parser
294
- # @param [Array] argvs List of strings including email address
295
- # @return [Array, Nil] Email address list or Undef when there is no
296
- # email address in the argument
297
- # @until v4.22.1
298
- def self.parse(argvs = nil)
299
- return nil unless argvs
300
- return nil unless argvs.is_a? Array
301
- return nil if argvs.empty?
302
-
303
- warn ' ***warning: Sisimai::Address.parse is marked as obsoleted'
304
- addrs = []
305
-
306
- argvs.each do |e|
307
- # Parse each element in the array
308
- # 1. The element must include '@'.
309
- # 2. The element must not include character except from 0x20 to 0x7e.
310
- next unless e
311
- next unless e.is_a? Object::String
312
- next if e.empty?
313
-
314
- v = Sisimai::Address.find(e, 1) || []
315
- next if v.empty?
316
- v.each { |f| addrs << f[:address] }
317
- end
318
-
319
- return nil if addrs.empty?
320
- return addrs
321
- end
322
-
323
294
  # Runs like ruleset 3,4 of sendmail.cf
324
295
  # @param [String] input Text including an email address
325
296
  # @return [String] Email address without comment, brackets
@@ -343,7 +314,7 @@ module Sisimai
343
314
  verp0 = ''
344
315
 
345
316
  if cv = local.match(/\A[-_\w]+?[+](\w[-._\w]+\w)[=](\w[-.\w]+\w)\z/)
346
- verp0 = sprintf("%s@%s", cv[1], cv[2])
317
+ verp0 = sprintf('%s@%s', cv[1], cv[2])
347
318
  return verp0 if Sisimai::RFC5322.is_emailaddress(verp0)
348
319
  else
349
320
  return ''
@@ -382,7 +353,7 @@ module Sisimai
382
353
 
383
354
  # Constructor of Sisimai::Address
384
355
  # @param <str> [String] argv1 Email address
385
- # @return [Sisimai::Address, Nil] Object or Undef when the email
356
+ # @return [Sisimai::Address, Nil] Object or nil when the email
386
357
  # address was not valid
387
358
  def initialize(argv1)
388
359
  return nil unless argv1
@@ -393,7 +364,7 @@ module Sisimai
393
364
  thing = addrs.shift
394
365
 
395
366
  if cv = thing[:address].match(/\A([^\s]+)[@]([^@]+)\z/) ||
396
- cv = thing[:address].match(/\A(["].+?["])[@]([^@]+)\z/)
367
+ thing[:address].match(/\A(["].+?["])[@]([^@]+)\z/)
397
368
  # Get the local part and the domain part from the email address
398
369
  lpart = cv[1]
399
370
  dpart = cv[2]
@@ -418,7 +389,7 @@ module Sisimai
418
389
  end
419
390
  @user = lpart
420
391
  @host = dpart
421
- @address = sprintf("%s@%s", lpart, dpart)
392
+ @address = sprintf('%s@%s', lpart, dpart)
422
393
 
423
394
  else
424
395
  # The argument does not include "@"
@@ -444,6 +415,15 @@ module Sisimai
444
415
  return false
445
416
  end
446
417
 
418
+ # Check the "address" is an undisclosed address or not
419
+ # @param [None]
420
+ # @return [Boolean] true: Undisclosed address
421
+ # false: Is not undisclosed address
422
+ def is_undisclosed
423
+ return true if self.host == @@undisclosed
424
+ return false
425
+ end
426
+
447
427
  # Returns the value of address as String
448
428
  # @return [String] Email address
449
429
  def to_json(*)
data/lib/sisimai/arf.rb CHANGED
@@ -15,7 +15,7 @@ module Sisimai
15
15
  )
16
16
  }x,
17
17
  :'subject' => %r/complaint[ ]about[ ]message[ ]from[ ]/,
18
- }
18
+ }.freeze
19
19
  # http://tools.ietf.org/html/rfc5965
20
20
  # http://en.wikipedia.org/wiki/Feedback_loop_(email)
21
21
  # http://en.wikipedia.org/wiki/Abuse_Reporting_Format
@@ -35,7 +35,7 @@ module Sisimai
35
35
  }x,
36
36
  :rfc822 => %r[\AContent-Type: (:?message/rfc822|text/rfc822-headers)],
37
37
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
38
- }
38
+ }.freeze
39
39
  Indicators = Sisimai::Bite::Email.INDICATORS
40
40
  LongFields = Sisimai::RFC5322.LONGFIELDS
41
41
  RFC822Head = Sisimai::RFC5322.HEADERFIELDS
@@ -80,7 +80,7 @@ module Sisimai
80
80
  # @options mhead [String] others Other required headers
81
81
  # @param [String] mbody Message body of a bounce email
82
82
  # @return [Hash, Nil] Bounce data list and message/rfc822 part
83
- # or Undef if it failed to parse or the
83
+ # or nil if it failed to parse or the
84
84
  # arguments are missing
85
85
  def scan(mhead, mbody)
86
86
  return nil unless self.is_arf(mhead)
@@ -136,7 +136,7 @@ module Sisimai
136
136
  end
137
137
  end
138
138
 
139
- if readcursor & Indicators[:'message-rfc822'] == 0
139
+ if (readcursor & Indicators[:'message-rfc822']).zero?
140
140
  # Beginning of the original message part
141
141
  if e =~ Re1[:rfc822]
142
142
  readcursor |= Indicators[:'message-rfc822']
data/lib/sisimai/bite.rb CHANGED
@@ -3,6 +3,7 @@ module Sisimai
3
3
  module Bite
4
4
  class << self
5
5
  # Imported from p5-Sisimail/lib/Sisimai/Bite.pm
6
+ require 'sisimai/rfc5322'
6
7
 
7
8
  # Data structure for parsed bounce messages
8
9
  # @return [Hash] Data structure for delivery status
@@ -1,11 +1,10 @@
1
1
  module Sisimai
2
2
  module Bite
3
+ # Sisimai::Bite::Email- Base class for Sisimai::Bite::Email::*
3
4
  module Email
4
- # Sisimai::Bite::Email- Base class for Sisimai::Bite::Email::*
5
5
  class << self
6
6
  # Imported from p5-Sisimail/lib/Sisimai/Bite/Email.pm
7
7
  require 'sisimai/bite'
8
- require 'sisimai/rfc5322'
9
8
 
10
9
  # @abstract Flags for position variable
11
10
  # @return [Hash] Position flag data
@@ -27,9 +26,9 @@ module Sisimai
27
26
  Google Yahoo GSuite Aol Outlook Office365 SendGrid AmazonSES MailRu
28
27
  Yandex MessagingServer Domino Notes ReceivingSES AmazonWorkMail Verizon
29
28
  GMX Bigfoot Facebook Zoho EinsUndEins MessageLabs EZweb KDDI Biglobe
30
- ApacheJames McAfee MXLogic MailFoundry IMailServer
29
+ ApacheJames McAfee MXLogic MailFoundry IMailServer
31
30
  MFILTER Activehunter InterScanMSS SurfControl MailMarshalSMTP
32
- X1 X2 X3 X4 X5 V5sendmail
31
+ X1 X2 X3 X4 X5 V5sendmail
33
32
  |
34
33
  end
35
34
 
@@ -1,8 +1,8 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::Activehunter parses a bounce email which created
3
+ # by TransWARE Active!hunter.
4
+ # Methods in the module are called from only Sisimai::Message.
2
5
  module Activehunter
3
- # Sisimai::Bite::Email::Activehunter parses a bounce email which created
4
- # by TransWARE Active!hunter.
5
- # Methods in the module are called from only Sisimai::Message.
6
6
  class << self
7
7
  # Imported from p5-Sisimail/lib/Sisimai/Bite/Email/Activehunter.pm
8
8
  require 'sisimai/bite/email'
@@ -10,13 +10,13 @@ module Sisimai::Bite::Email
10
10
  Re0 = {
11
11
  :from => %r/\A"MAILER-DAEMON"/,
12
12
  :subject => %r/FAILURE NOTICE :/,
13
- }
13
+ }.freeze
14
14
  Re1 = {
15
15
  :begin => %r/\A ----- The following addresses had permanent fatal errors -----\z/,
16
16
  :error => %r/\A ----- Transcript of session follows -----\z/,
17
17
  :rfc822 => %r|\AContent-type: message/rfc822\z|,
18
18
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
19
- }
19
+ }.freeze
20
20
  Indicators = Sisimai::Bite::Email.INDICATORS
21
21
 
22
22
  def description; return 'TransWARE Active!hunter'; end
@@ -57,7 +57,7 @@ module Sisimai::Bite::Email
57
57
  end
58
58
  end
59
59
 
60
- if readcursor & Indicators[:'message-rfc822'] == 0
60
+ if (readcursor & Indicators[:'message-rfc822']).zero?
61
61
  # Beginning of the original message part
62
62
  if e =~ Re1[:rfc822]
63
63
  readcursor |= Indicators[:'message-rfc822']
@@ -76,7 +76,7 @@ module Sisimai::Bite::Email
76
76
 
77
77
  else
78
78
  # Before "message/rfc822"
79
- next if readcursor & Indicators[:deliverystatus] == 0
79
+ next if (readcursor & Indicators[:deliverystatus]).zero?
80
80
  next if e.empty?
81
81
 
82
82
  # ----- The following addresses had permanent fatal errors -----
@@ -1,18 +1,18 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::AmazonSES parses a bounce email which created by
3
+ # Amazon Simple Email Service.
4
+ # Methods in the module are called from only Sisimai::Message.
2
5
  module AmazonSES
3
- # Sisimai::Bite::Email::AmazonSES parses a bounce email which created by
4
- # Amazon Simple Email Service.
5
- # Methods in the module are called from only Sisimai::Message.
6
6
  class << self
7
7
  # Imported from p5-Sisimail/lib/Sisimai/Bite/Email/AmazonSES.pm
8
8
  require 'sisimai/bite/email'
9
9
 
10
10
  # http://aws.amazon.com/ses/
11
- ReE = { :'x-mailer' => %r/Amazon[ ]WorkMail/ }
11
+ ReE = { :'x-mailer' => %r/Amazon[ ]WorkMail/ }.freeze
12
12
  Re0 = {
13
13
  :from => %r/\AMAILER-DAEMON[@]email[-]bounces[.]amazonses[.]com\z/,
14
14
  :subject => %r/\ADelivery Status Notification [(]Failure[)]\z/,
15
- }
15
+ }.freeze
16
16
  Re1 = {
17
17
  :begin => %r/\A(?:
18
18
  The[ ]following[ ]message[ ]to[ ][<]
@@ -21,10 +21,10 @@ module Sisimai::Bite::Email
21
21
  /x,
22
22
  :rfc822 => %r|\Acontent-type: message/rfc822\z|,
23
23
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
24
- }
24
+ }.freeze
25
25
  ReFailure = {
26
26
  expired: %r/Delivery[ ]expired/x,
27
- }
27
+ }.freeze
28
28
  Indicators = Sisimai::Bite::Email.INDICATORS
29
29
 
30
30
  def description; return 'Amazon SES(Sending): http://aws.amazon.com/ses/'; end
@@ -66,7 +66,7 @@ module Sisimai::Bite::Email
66
66
  blanklines = 0 # (Integer) The number of blank lines
67
67
  readcursor = 0 # (Integer) Points the current cursor position
68
68
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
69
- connvalues = 0 # (Integer) Flag, 1 if all the value of $connheader have been set
69
+ connvalues = 0 # (Integer) Flag, 1 if all the value of connheader have been set
70
70
  connheader = {
71
71
  'lhost' => '', # The value of Reporting-MTA header
72
72
  }
@@ -85,7 +85,7 @@ module Sisimai::Bite::Email
85
85
  end
86
86
  end
87
87
 
88
- if readcursor & Indicators[:'message-rfc822'] == 0
88
+ if (readcursor & Indicators[:'message-rfc822']).zero?
89
89
  # Beginning of the original message part
90
90
  if e =~ Re1[:rfc822]
91
91
  readcursor |= Indicators[:'message-rfc822']
@@ -105,7 +105,7 @@ module Sisimai::Bite::Email
105
105
 
106
106
  else
107
107
  # Before "message/rfc822"
108
- next if readcursor & Indicators[:deliverystatus] == 0
108
+ next if (readcursor & Indicators[:deliverystatus]).zero?
109
109
  next if e.empty?
110
110
 
111
111
  if connvalues == connheader.keys.size
@@ -192,12 +192,12 @@ module Sisimai::Bite::Email
192
192
  if recipients.zero? && mbody =~ /notificationType/
193
193
  # Try to parse with Sisimai::Bite::JSON::AmazonSES module
194
194
  require 'sisimai/bite/json/amazonses'
195
- e = Sisimai::Bite::JSON::AmazonSES.scan(mhead, mbody)
195
+ j = Sisimai::Bite::JSON::AmazonSES.scan(mhead, mbody)
196
196
 
197
- if e['ds'].is_a? Array
197
+ if j['ds'].is_a? Array
198
198
  # Update dscontents
199
- dscontents = e['ds']
200
- recipients = e['ds'].size
199
+ dscontents = j['ds']
200
+ recipients = j['ds'].size
201
201
  end
202
202
  end
203
203
 
@@ -1,7 +1,7 @@
1
1
  module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::AmazonWorkMail parses a bounce email which created by
3
+ # Amazon WorkMail. Methods in the module are called from only Sisimai::Message.
2
4
  module AmazonWorkMail
3
- # Sisimai::Bite::Email::AmazonWorkMail parses a bounce email which created by
4
- # Amazon WorkMail. Methods in the module are called from only Sisimai::Message.
5
5
  class << self
6
6
  # Imported from p5-Sisimail/lib/Sisimai/Bite/Email/AmazonWorkMail.pm
7
7
  require 'sisimai/bite/email'
@@ -11,12 +11,12 @@ module Sisimai::Bite::Email
11
11
  :'subject' => %r/Delivery[_ ]Status[_ ]Notification[_ ].+Failure/,
12
12
  :'received' => %r/.+[.]smtp-out[.].+[.]amazonses[.]com\b/,
13
13
  :'x-mailer' => %r/\AAmazon WorkMail\z/,
14
- }
14
+ }.freeze
15
15
  Re1 = {
16
16
  :begin => %r/\ATechnical report:\z/,
17
17
  :rfc822 => %r|\Acontent-type: message/rfc822\z|,
18
18
  :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
19
- }
19
+ }.freeze
20
20
  Indicators = Sisimai::Bite::Email.INDICATORS
21
21
 
22
22
  def description; return 'Amazon WorkMail: https://aws.amazon.com/workmail/'; end
@@ -60,7 +60,7 @@ module Sisimai::Bite::Email
60
60
  blanklines = 0 # (Integer) The number of blank lines
61
61
  readcursor = 0 # (Integer) Points the current cursor position
62
62
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
63
- connvalues = 0 # (Integer) Flag, 1 if all the value of $connheader have been set
63
+ connvalues = 0 # (Integer) Flag, 1 if all the value of connheader have been set
64
64
  connheader = {
65
65
  'lhost' => '', # The value of Reporting-MTA header
66
66
  }
@@ -75,7 +75,7 @@ module Sisimai::Bite::Email
75
75
  end
76
76
  end
77
77
 
78
- if readcursor & Indicators[:'message-rfc822'] == 0
78
+ if (readcursor & Indicators[:'message-rfc822']).zero?
79
79
  # Beginning of the original message part
80
80
  if e =~ Re1[:rfc822]
81
81
  readcursor |= Indicators[:'message-rfc822']
@@ -94,7 +94,7 @@ module Sisimai::Bite::Email
94
94
 
95
95
  else
96
96
  # Before "message/rfc822"
97
- next if readcursor & Indicators[:deliverystatus] == 0
97
+ next if (readcursor & Indicators[:deliverystatus]).zero?
98
98
  next if e.empty?
99
99
 
100
100
  if connvalues == connheader.keys.size