mail 2.1.5.3 → 2.2.0

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

Potentially problematic release.


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

Files changed (60) hide show
  1. data/CHANGELOG.rdoc +16 -0
  2. data/Rakefile +1 -1
  3. data/lib/mail.rb +3 -1
  4. data/lib/mail/body.rb +3 -2
  5. data/lib/mail/core_extensions/string.rb +4 -0
  6. data/lib/mail/elements/address.rb +3 -3
  7. data/lib/mail/elements/content_transfer_encoding_element.rb +1 -1
  8. data/lib/mail/encodings.rb +48 -8
  9. data/lib/mail/encodings/quoted_printable.rb +1 -14
  10. data/lib/mail/field.rb +44 -44
  11. data/lib/mail/fields/bcc_field.rb +3 -2
  12. data/lib/mail/fields/cc_field.rb +3 -2
  13. data/lib/mail/fields/comments_field.rb +3 -3
  14. data/lib/mail/fields/common/common_address.rb +19 -10
  15. data/lib/mail/fields/common/common_field.rb +6 -6
  16. data/lib/mail/fields/common/common_message_id.rb +1 -1
  17. data/lib/mail/fields/content_description_field.rb +3 -3
  18. data/lib/mail/fields/content_disposition_field.rb +3 -3
  19. data/lib/mail/fields/content_id_field.rb +6 -6
  20. data/lib/mail/fields/content_location_field.rb +3 -3
  21. data/lib/mail/fields/content_transfer_encoding_field.rb +6 -3
  22. data/lib/mail/fields/content_type_field.rb +8 -7
  23. data/lib/mail/fields/date_field.rb +8 -8
  24. data/lib/mail/fields/from_field.rb +3 -3
  25. data/lib/mail/fields/in_reply_to_field.rb +3 -2
  26. data/lib/mail/fields/keywords_field.rb +3 -2
  27. data/lib/mail/fields/message_id_field.rb +4 -3
  28. data/lib/mail/fields/mime_version_field.rb +5 -6
  29. data/lib/mail/fields/received_field.rb +3 -2
  30. data/lib/mail/fields/references_field.rb +3 -3
  31. data/lib/mail/fields/reply_to_field.rb +3 -3
  32. data/lib/mail/fields/resent_bcc_field.rb +3 -3
  33. data/lib/mail/fields/resent_cc_field.rb +3 -3
  34. data/lib/mail/fields/resent_date_field.rb +7 -7
  35. data/lib/mail/fields/resent_from_field.rb +3 -3
  36. data/lib/mail/fields/resent_message_id_field.rb +3 -3
  37. data/lib/mail/fields/resent_sender_field.rb +3 -3
  38. data/lib/mail/fields/resent_to_field.rb +3 -3
  39. data/lib/mail/fields/return_path_field.rb +3 -3
  40. data/lib/mail/fields/sender_field.rb +3 -3
  41. data/lib/mail/fields/structured_field.rb +12 -3
  42. data/lib/mail/fields/subject_field.rb +3 -2
  43. data/lib/mail/fields/to_field.rb +3 -3
  44. data/lib/mail/fields/unstructured_field.rb +68 -26
  45. data/lib/mail/header.rb +20 -4
  46. data/lib/mail/message.rb +36 -26
  47. data/lib/mail/parsers/content_disposition.rb +1 -1
  48. data/lib/mail/parsers/content_disposition.treetop +1 -1
  49. data/lib/mail/parsers/content_transfer_encoding.rb +1 -8
  50. data/lib/mail/parsers/content_transfer_encoding.treetop +1 -1
  51. data/lib/mail/parsers/content_type.rb +1 -1
  52. data/lib/mail/parsers/content_type.treetop +1 -1
  53. data/lib/mail/parsers/rfc2045.rb +6 -6
  54. data/lib/mail/parsers/rfc2045.treetop +1 -1
  55. data/lib/mail/parsers/rfc2822.rb +236 -236
  56. data/lib/mail/parsers/rfc2822.treetop +12 -12
  57. data/lib/mail/patterns.rb +6 -4
  58. data/lib/mail/utilities.rb +8 -5
  59. data/lib/mail/version.rb +3 -4
  60. metadata +16 -17
@@ -187,7 +187,7 @@ module Mail
187
187
  if r1
188
188
  r0 = r1
189
189
  else
190
- r2 = _nt_x_token
190
+ r2 = _nt_custom_x_token
191
191
  if r2
192
192
  r0 = r2
193
193
  else
@@ -19,7 +19,7 @@ module Mail
19
19
  end
20
20
 
21
21
  rule extension_token
22
- ietf_token / x_token
22
+ ietf_token / custom_x_token
23
23
  end
24
24
 
25
25
  rule parameter
@@ -98,12 +98,6 @@ module Mail
98
98
  end
99
99
  end
100
100
 
101
- module Encoding2
102
- def text_value
103
- x_token.text_value
104
- end
105
- end
106
-
107
101
  def _nt_encoding
108
102
  start_index = index
109
103
  if node_cache[:encoding].has_key?(index)
@@ -145,8 +139,7 @@ module Mail
145
139
  if r1
146
140
  r0 = r1
147
141
  else
148
- r5 = _nt_x_token
149
- r5.extend(Encoding2)
142
+ r5 = _nt_custom_x_token
150
143
  if r5
151
144
  r0 = r5
152
145
  else
@@ -13,7 +13,7 @@ module Mail
13
13
  def text_value
14
14
  ietf_token.text_value
15
15
  end
16
- } / x_token
16
+ } / custom_x_token
17
17
  end
18
18
 
19
19
  end
@@ -309,7 +309,7 @@ module Mail
309
309
  if r1
310
310
  r0 = r1
311
311
  else
312
- r2 = _nt_x_token
312
+ r2 = _nt_custom_x_token
313
313
  if r2
314
314
  r0 = r2
315
315
  else
@@ -27,7 +27,7 @@ module Mail
27
27
  end
28
28
 
29
29
  rule extension_token
30
- ietf_token / x_token
30
+ ietf_token / custom_x_token
31
31
  end
32
32
 
33
33
  rule sub_type
@@ -280,13 +280,13 @@ module Mail
280
280
  r0
281
281
  end
282
282
 
283
- module XToken0
283
+ module CustomXToken0
284
284
  end
285
285
 
286
- def _nt_x_token
286
+ def _nt_custom_x_token
287
287
  start_index = index
288
- if node_cache[:x_token].has_key?(index)
289
- cached = node_cache[:x_token][index]
288
+ if node_cache[:custom_x_token].has_key?(index)
289
+ cached = node_cache[:custom_x_token][index]
290
290
  if cached
291
291
  cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
292
292
  @index = cached.interval.end
@@ -332,13 +332,13 @@ module Mail
332
332
  end
333
333
  if s0.last
334
334
  r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
335
- r0.extend(XToken0)
335
+ r0.extend(CustomXToken0)
336
336
  else
337
337
  @index = i0
338
338
  r0 = nil
339
339
  end
340
340
 
341
- node_cache[:x_token][start_index] = r0
341
+ node_cache[:custom_x_token][start_index] = r0
342
342
 
343
343
  r0
344
344
  end
@@ -12,7 +12,7 @@ module Mail
12
12
  "quoted-printable" / "base64"
13
13
  end
14
14
 
15
- rule x_token
15
+ rule custom_x_token
16
16
  [xX] "-" token+
17
17
  end
18
18
 
@@ -176,6 +176,198 @@ module Mail
176
176
  r0
177
177
  end
178
178
 
179
+ module FWS0
180
+ def CRLF
181
+ elements[1]
182
+ end
183
+
184
+ end
185
+
186
+ module FWS1
187
+ def CRLF
188
+ elements[0]
189
+ end
190
+
191
+ end
192
+
193
+ def _nt_FWS
194
+ start_index = index
195
+ if node_cache[:FWS].has_key?(index)
196
+ cached = node_cache[:FWS][index]
197
+ if cached
198
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
199
+ @index = cached.interval.end
200
+ end
201
+ return cached
202
+ end
203
+
204
+ i0 = index
205
+ i1, s1 = index, []
206
+ s2, i2 = [], index
207
+ loop do
208
+ r3 = _nt_WSP
209
+ if r3
210
+ s2 << r3
211
+ else
212
+ break
213
+ end
214
+ end
215
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
216
+ s1 << r2
217
+ if r2
218
+ r4 = _nt_CRLF
219
+ s1 << r4
220
+ if r4
221
+ s5, i5 = [], index
222
+ loop do
223
+ r6 = _nt_WSP
224
+ if r6
225
+ s5 << r6
226
+ else
227
+ break
228
+ end
229
+ end
230
+ if s5.empty?
231
+ @index = i5
232
+ r5 = nil
233
+ else
234
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
235
+ end
236
+ s1 << r5
237
+ end
238
+ end
239
+ if s1.last
240
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
241
+ r1.extend(FWS0)
242
+ else
243
+ @index = i1
244
+ r1 = nil
245
+ end
246
+ if r1
247
+ r0 = r1
248
+ else
249
+ i7, s7 = index, []
250
+ r8 = _nt_CRLF
251
+ s7 << r8
252
+ if r8
253
+ s9, i9 = [], index
254
+ loop do
255
+ r10 = _nt_WSP
256
+ if r10
257
+ s9 << r10
258
+ else
259
+ break
260
+ end
261
+ end
262
+ if s9.empty?
263
+ @index = i9
264
+ r9 = nil
265
+ else
266
+ r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
267
+ end
268
+ s7 << r9
269
+ end
270
+ if s7.last
271
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
272
+ r7.extend(FWS1)
273
+ else
274
+ @index = i7
275
+ r7 = nil
276
+ end
277
+ if r7
278
+ r0 = r7
279
+ else
280
+ r11 = _nt_obs_FWS
281
+ if r11
282
+ r0 = r11
283
+ else
284
+ @index = i0
285
+ r0 = nil
286
+ end
287
+ end
288
+ end
289
+
290
+ node_cache[:FWS][start_index] = r0
291
+
292
+ r0
293
+ end
294
+
295
+ module CFWS0
296
+ def comment
297
+ elements[1]
298
+ end
299
+ end
300
+
301
+ module CFWS1
302
+ end
303
+
304
+ def _nt_CFWS
305
+ start_index = index
306
+ if node_cache[:CFWS].has_key?(index)
307
+ cached = node_cache[:CFWS][index]
308
+ if cached
309
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
310
+ @index = cached.interval.end
311
+ end
312
+ return cached
313
+ end
314
+
315
+ i0, s0 = index, []
316
+ s1, i1 = [], index
317
+ loop do
318
+ i2, s2 = index, []
319
+ s3, i3 = [], index
320
+ loop do
321
+ r4 = _nt_FWS
322
+ if r4
323
+ s3 << r4
324
+ else
325
+ break
326
+ end
327
+ end
328
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
329
+ s2 << r3
330
+ if r3
331
+ r5 = _nt_comment
332
+ s2 << r5
333
+ end
334
+ if s2.last
335
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
336
+ r2.extend(CFWS0)
337
+ else
338
+ @index = i2
339
+ r2 = nil
340
+ end
341
+ if r2
342
+ s1 << r2
343
+ else
344
+ break
345
+ end
346
+ end
347
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
348
+ s0 << r1
349
+ if r1
350
+ r7 = _nt_FWS
351
+ if r7
352
+ r6 = r7
353
+ else
354
+ r6 = instantiate_node(SyntaxNode,input, index...index)
355
+ end
356
+ s0 << r6
357
+ end
358
+ if s0.last
359
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
360
+ r0.extend(CFWS1)
361
+ else
362
+ @index = i0
363
+ r0 = nil
364
+ end
365
+
366
+ node_cache[:CFWS][start_index] = r0
367
+
368
+ r0
369
+ end
370
+
179
371
  def _nt_NO_WS_CTL
180
372
  start_index = index
181
373
  if node_cache[:NO_WS_CTL].has_key?(index)
@@ -393,198 +585,6 @@ module Mail
393
585
  r0
394
586
  end
395
587
 
396
- module FWS0
397
- def CRLF
398
- elements[1]
399
- end
400
-
401
- end
402
-
403
- module FWS1
404
- def CRLF
405
- elements[0]
406
- end
407
-
408
- end
409
-
410
- def _nt_FWS
411
- start_index = index
412
- if node_cache[:FWS].has_key?(index)
413
- cached = node_cache[:FWS][index]
414
- if cached
415
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
416
- @index = cached.interval.end
417
- end
418
- return cached
419
- end
420
-
421
- i0 = index
422
- i1, s1 = index, []
423
- s2, i2 = [], index
424
- loop do
425
- r3 = _nt_WSP
426
- if r3
427
- s2 << r3
428
- else
429
- break
430
- end
431
- end
432
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
433
- s1 << r2
434
- if r2
435
- r4 = _nt_CRLF
436
- s1 << r4
437
- if r4
438
- s5, i5 = [], index
439
- loop do
440
- r6 = _nt_WSP
441
- if r6
442
- s5 << r6
443
- else
444
- break
445
- end
446
- end
447
- if s5.empty?
448
- @index = i5
449
- r5 = nil
450
- else
451
- r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
452
- end
453
- s1 << r5
454
- end
455
- end
456
- if s1.last
457
- r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
458
- r1.extend(FWS0)
459
- else
460
- @index = i1
461
- r1 = nil
462
- end
463
- if r1
464
- r0 = r1
465
- else
466
- i7, s7 = index, []
467
- r8 = _nt_CRLF
468
- s7 << r8
469
- if r8
470
- s9, i9 = [], index
471
- loop do
472
- r10 = _nt_WSP
473
- if r10
474
- s9 << r10
475
- else
476
- break
477
- end
478
- end
479
- if s9.empty?
480
- @index = i9
481
- r9 = nil
482
- else
483
- r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
484
- end
485
- s7 << r9
486
- end
487
- if s7.last
488
- r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
489
- r7.extend(FWS1)
490
- else
491
- @index = i7
492
- r7 = nil
493
- end
494
- if r7
495
- r0 = r7
496
- else
497
- r11 = _nt_obs_FWS
498
- if r11
499
- r0 = r11
500
- else
501
- @index = i0
502
- r0 = nil
503
- end
504
- end
505
- end
506
-
507
- node_cache[:FWS][start_index] = r0
508
-
509
- r0
510
- end
511
-
512
- module CFWS0
513
- def comment
514
- elements[1]
515
- end
516
- end
517
-
518
- module CFWS1
519
- end
520
-
521
- def _nt_CFWS
522
- start_index = index
523
- if node_cache[:CFWS].has_key?(index)
524
- cached = node_cache[:CFWS][index]
525
- if cached
526
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
527
- @index = cached.interval.end
528
- end
529
- return cached
530
- end
531
-
532
- i0, s0 = index, []
533
- s1, i1 = [], index
534
- loop do
535
- i2, s2 = index, []
536
- s3, i3 = [], index
537
- loop do
538
- r4 = _nt_FWS
539
- if r4
540
- s3 << r4
541
- else
542
- break
543
- end
544
- end
545
- r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
546
- s2 << r3
547
- if r3
548
- r5 = _nt_comment
549
- s2 << r5
550
- end
551
- if s2.last
552
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
553
- r2.extend(CFWS0)
554
- else
555
- @index = i2
556
- r2 = nil
557
- end
558
- if r2
559
- s1 << r2
560
- else
561
- break
562
- end
563
- end
564
- r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
565
- s0 << r1
566
- if r1
567
- r7 = _nt_FWS
568
- if r7
569
- r6 = r7
570
- else
571
- r6 = instantiate_node(SyntaxNode,input, index...index)
572
- end
573
- s0 << r6
574
- end
575
- if s0.last
576
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
577
- r0.extend(CFWS1)
578
- else
579
- @index = i0
580
- r0 = nil
581
- end
582
-
583
- node_cache[:CFWS][start_index] = r0
584
-
585
- r0
586
- end
587
-
588
588
  def _nt_ctext
589
589
  start_index = index
590
590
  if node_cache[:ctext].has_key?(index)
@@ -1621,6 +1621,50 @@ module Mail
1621
1621
  r0
1622
1622
  end
1623
1623
 
1624
+ def _nt_phrase
1625
+ start_index = index
1626
+ if node_cache[:phrase].has_key?(index)
1627
+ cached = node_cache[:phrase][index]
1628
+ if cached
1629
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1630
+ @index = cached.interval.end
1631
+ end
1632
+ return cached
1633
+ end
1634
+
1635
+ i0 = index
1636
+ r1 = _nt_obs_phrase
1637
+ if r1
1638
+ r0 = r1
1639
+ else
1640
+ s2, i2 = [], index
1641
+ loop do
1642
+ r3 = _nt_word
1643
+ if r3
1644
+ s2 << r3
1645
+ else
1646
+ break
1647
+ end
1648
+ end
1649
+ if s2.empty?
1650
+ @index = i2
1651
+ r2 = nil
1652
+ else
1653
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1654
+ end
1655
+ if r2
1656
+ r0 = r2
1657
+ else
1658
+ @index = i0
1659
+ r0 = nil
1660
+ end
1661
+ end
1662
+
1663
+ node_cache[:phrase][start_index] = r0
1664
+
1665
+ r0
1666
+ end
1667
+
1624
1668
  def _nt_word
1625
1669
  start_index = index
1626
1670
  if node_cache[:word].has_key?(index)
@@ -1739,50 +1783,6 @@ module Mail
1739
1783
  r0
1740
1784
  end
1741
1785
 
1742
- def _nt_phrase
1743
- start_index = index
1744
- if node_cache[:phrase].has_key?(index)
1745
- cached = node_cache[:phrase][index]
1746
- if cached
1747
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1748
- @index = cached.interval.end
1749
- end
1750
- return cached
1751
- end
1752
-
1753
- i0 = index
1754
- r1 = _nt_obs_phrase
1755
- if r1
1756
- r0 = r1
1757
- else
1758
- s2, i2 = [], index
1759
- loop do
1760
- r3 = _nt_word
1761
- if r3
1762
- s2 << r3
1763
- else
1764
- break
1765
- end
1766
- end
1767
- if s2.empty?
1768
- @index = i2
1769
- r2 = nil
1770
- else
1771
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1772
- end
1773
- if r2
1774
- r0 = r2
1775
- else
1776
- @index = i0
1777
- r0 = nil
1778
- end
1779
- end
1780
-
1781
- node_cache[:phrase][start_index] = r0
1782
-
1783
- r0
1784
- end
1785
-
1786
1786
  module DomainLiteral0
1787
1787
  def dcontent
1788
1788
  elements[1]