tmail_es 1.2.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES +83 -0
  3. data/LICENSE +21 -0
  4. data/NOTES +7 -0
  5. data/README +182 -0
  6. data/Rakefile +2 -0
  7. data/ext/Makefile +20 -0
  8. data/ext/tmailscanner/tmail/MANIFEST +4 -0
  9. data/ext/tmailscanner/tmail/depend +1 -0
  10. data/ext/tmailscanner/tmail/extconf.rb +33 -0
  11. data/ext/tmailscanner/tmail/tmailscanner.c +614 -0
  12. data/lib/tmail/Makefile +18 -0
  13. data/lib/tmail/address.rb +392 -0
  14. data/lib/tmail/attachments.rb +65 -0
  15. data/lib/tmail/base64.rb +46 -0
  16. data/lib/tmail/compat.rb +41 -0
  17. data/lib/tmail/config.rb +67 -0
  18. data/lib/tmail/core_extensions.rb +63 -0
  19. data/lib/tmail/encode.rb +590 -0
  20. data/lib/tmail/header.rb +962 -0
  21. data/lib/tmail/index.rb +9 -0
  22. data/lib/tmail/interface.rb +1162 -0
  23. data/lib/tmail/loader.rb +3 -0
  24. data/lib/tmail/mail.rb +578 -0
  25. data/lib/tmail/mailbox.rb +496 -0
  26. data/lib/tmail/main.rb +6 -0
  27. data/lib/tmail/mbox.rb +3 -0
  28. data/lib/tmail/net.rb +250 -0
  29. data/lib/tmail/obsolete.rb +132 -0
  30. data/lib/tmail/parser.rb +1060 -0
  31. data/lib/tmail/parser.y +416 -0
  32. data/lib/tmail/port.rb +379 -0
  33. data/lib/tmail/quoting.rb +164 -0
  34. data/lib/tmail/require_arch.rb +58 -0
  35. data/lib/tmail/scanner.rb +49 -0
  36. data/lib/tmail/scanner_r.rb +261 -0
  37. data/lib/tmail/stringio.rb +280 -0
  38. data/lib/tmail/utils.rb +361 -0
  39. data/lib/tmail/vendor/rchardet-1.3/COPYING +504 -0
  40. data/lib/tmail/vendor/rchardet-1.3/README +12 -0
  41. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/big5freq.rb +927 -0
  42. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/big5prober.rb +42 -0
  43. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/chardistribution.rb +238 -0
  44. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/charsetgroupprober.rb +112 -0
  45. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/charsetprober.rb +75 -0
  46. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/codingstatemachine.rb +64 -0
  47. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/constants.rb +42 -0
  48. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/escprober.rb +89 -0
  49. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/escsm.rb +244 -0
  50. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/eucjpprober.rb +88 -0
  51. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/euckrfreq.rb +596 -0
  52. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/euckrprober.rb +42 -0
  53. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/euctwfreq.rb +430 -0
  54. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/euctwprober.rb +42 -0
  55. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312freq.rb +474 -0
  56. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312prober.rb +42 -0
  57. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/hebrewprober.rb +289 -0
  58. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/jisfreq.rb +570 -0
  59. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/jpcntx.rb +229 -0
  60. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langbulgarianmodel.rb +229 -0
  61. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langcyrillicmodel.rb +330 -0
  62. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langgreekmodel.rb +227 -0
  63. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langhebrewmodel.rb +202 -0
  64. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langhungarianmodel.rb +226 -0
  65. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langthaimodel.rb +201 -0
  66. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/latin1prober.rb +147 -0
  67. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/mbcharsetprober.rb +89 -0
  68. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/mbcsgroupprober.rb +45 -0
  69. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/mbcssm.rb +542 -0
  70. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/sbcharsetprober.rb +124 -0
  71. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/sbcsgroupprober.rb +56 -0
  72. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/sjisprober.rb +88 -0
  73. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/universaldetector.rb +167 -0
  74. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/utf8prober.rb +87 -0
  75. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet.rb +67 -0
  76. data/lib/tmail/version.rb +40 -0
  77. data/lib/tmail.rb +6 -0
  78. data/setup.rb +1482 -0
  79. data/test/extctrl.rb +6 -0
  80. data/test/fixtures/apple_unquoted_content_type +44 -0
  81. data/test/fixtures/inline_attachment.txt +2095 -0
  82. data/test/fixtures/iso_8859_1_email_without_encoding_and_message_id.txt +16 -0
  83. data/test/fixtures/mailbox +414 -0
  84. data/test/fixtures/mailbox.zip +0 -0
  85. data/test/fixtures/mailbox_without_any_from_or_sender +10 -0
  86. data/test/fixtures/mailbox_without_from +11 -0
  87. data/test/fixtures/mailbox_without_return_path +12 -0
  88. data/test/fixtures/marked_as_iso_8859_1_but_it_is_utf_8.txt +33 -0
  89. data/test/fixtures/marked_as_utf_8_but_it_is_iso_8859_1.txt +56 -0
  90. data/test/fixtures/raw_attack_email_with_zero_length_whitespace +29 -0
  91. data/test/fixtures/raw_base64_decoded_string +0 -0
  92. data/test/fixtures/raw_base64_email +83 -0
  93. data/test/fixtures/raw_base64_encoded_string +1 -0
  94. data/test/fixtures/raw_email +14 -0
  95. data/test/fixtures/raw_email10 +20 -0
  96. data/test/fixtures/raw_email11 +34 -0
  97. data/test/fixtures/raw_email12 +32 -0
  98. data/test/fixtures/raw_email13 +29 -0
  99. data/test/fixtures/raw_email2 +114 -0
  100. data/test/fixtures/raw_email3 +70 -0
  101. data/test/fixtures/raw_email4 +59 -0
  102. data/test/fixtures/raw_email5 +19 -0
  103. data/test/fixtures/raw_email6 +20 -0
  104. data/test/fixtures/raw_email7 +66 -0
  105. data/test/fixtures/raw_email8 +47 -0
  106. data/test/fixtures/raw_email9 +28 -0
  107. data/test/fixtures/raw_email_bad_time +62 -0
  108. data/test/fixtures/raw_email_double_at_in_header +14 -0
  109. data/test/fixtures/raw_email_multiple_from +30 -0
  110. data/test/fixtures/raw_email_only_attachment +17 -0
  111. data/test/fixtures/raw_email_quoted_with_0d0a +14 -0
  112. data/test/fixtures/raw_email_reply +32 -0
  113. data/test/fixtures/raw_email_simple +11 -0
  114. data/test/fixtures/raw_email_string_in_date_field +17 -0
  115. data/test/fixtures/raw_email_trailing_dot +21 -0
  116. data/test/fixtures/raw_email_with_bad_date +48 -0
  117. data/test/fixtures/raw_email_with_illegal_boundary +58 -0
  118. data/test/fixtures/raw_email_with_mimepart_without_content_type +94 -0
  119. data/test/fixtures/raw_email_with_multipart_mixed_quoted_boundary +50 -0
  120. data/test/fixtures/raw_email_with_nested_attachment +100 -0
  121. data/test/fixtures/raw_email_with_partially_quoted_subject +14 -0
  122. data/test/fixtures/raw_email_with_quoted_attachment_filename +60 -0
  123. data/test/fixtures/raw_email_with_quoted_illegal_boundary +58 -0
  124. data/test/fixtures/raw_email_with_wrong_splitted_multibyte_encoded_word_subject +15 -0
  125. data/test/fixtures/the_only_part_is_a_word_document.txt +425 -0
  126. data/test/fixtures/unquoted_filename_in_attachment +177 -0
  127. data/test/kcode.rb +14 -0
  128. data/test/temp_test_one.rb +46 -0
  129. data/test/test_address.rb +1216 -0
  130. data/test/test_attachments.rb +133 -0
  131. data/test/test_base64.rb +64 -0
  132. data/test/test_encode.rb +139 -0
  133. data/test/test_header.rb +1021 -0
  134. data/test/test_helper.rb +9 -0
  135. data/test/test_mail.rb +756 -0
  136. data/test/test_mbox.rb +184 -0
  137. data/test/test_port.rb +440 -0
  138. data/test/test_quote.rb +107 -0
  139. data/test/test_scanner.rb +209 -0
  140. data/test/test_utils.rb +36 -0
  141. data/tmail_es.gemspec +35 -0
  142. metadata +257 -0
@@ -0,0 +1,177 @@
1
+ Return-path: <stuff+caf_=support=aaa.somewhere.com@gmail.com>
2
+ Delivery-date: Thu, 05 Jun 2008 10:53:29 -0700
3
+ Received: from [127.0.220.158] (helo=fg-out-1718.google.com)
4
+ by smtp.totallyrandom.com with esmtp (Exim 4.68)
5
+ (envelope-from <stuff+caf_=support=aaa.somewhere.com@gmail.com>)
6
+ id 1K4JeQ-0005Nd-Ij
7
+ for support@aaa.somewhere.com; Thu, 05 Jun 2008 10:53:29 -0700
8
+ Delivered-To: stuff@gmail.com
9
+ Mime-Version: 1.0 (Apple Message framework v753)
10
+ To: someone@wibble.com
11
+ Message-Id: <1234567@234567>
12
+ Content-Type: multipart/mixed; boundary=Apple-Mail-5-305464934
13
+ From: Wiffle Wonkle <someone@wiffleplace.com>
14
+ Subject: Attachment content type nil
15
+ Date: Thu, 5 Jun 2008 10:53:02 -0700
16
+ X-Mailer: Apple Mail (2.753)
17
+
18
+
19
+ --Apple-Mail-5-305464934
20
+ Content-Transfer-Encoding: 7bit
21
+ Content-Type: text/plain;
22
+ charset=US-ASCII;
23
+ delsp=yes;
24
+ format=flowed
25
+
26
+ There some text here. It's not really interesting.
27
+
28
+
29
+
30
+ --Apple-Mail-5-305464934
31
+ Content-Transfer-Encoding: base64
32
+ Content-Type: image/png; x-unix-mode=0644; x-mac-hide-extension=yes;
33
+ name=Picture 7.png
34
+ Content-Disposition: inline;
35
+ filename="Picture 7.png"
36
+
37
+ iVBORw0KGgoAAAANSUhEUgAAAlsAAADGCAIAAABqwNKSAAALLGlDQ1BJQ0MgUHJvZmlsZQAAeJyV
38
+ 12dYE1kbBuBnQAEFAyLSpASk19AtiEDoJUIEpQgYSIBogJAEFEURy+paUddeULDA4ipioaxlLeja
39
+ QERsgIIVWERRFHd1zfdjEopl99v5dWauc+ZMcj/vO9cAKm0sPp8nAyAlVSRg+npSIyKjqPJ3MRTy
40
+ UMBYaLEShHyPkJAgfPd4fwcEANRbs/h8nvh13cgzdx5XVRYmOzUvLnv5/XUAAIogIjIKIKwAqCWR
41
+ Y3cAavHkOAyA2hwRXwQQyQDUEpJZbIDIBmAlCGPSAaIIACWJHFcAoMST498BUDITkkQAcQ+QU01l
42
+ c1MB+U5Azo3NESYAFCsAbLYwIQWg5AHE55SUNDagkgfALIEvEAEqFQCsIyKjqOQjs20AF2tAVqv/
43
+ 2uwcoHQFoK/af83UDNBMBEr/7L/2lgkCAKFeK0x0sAcAEEqewNCHYvFbE0B+A/D3erH4Y4FY/Hch
44
+ INsE/MZLyBBkSv4vgrgB/Ns5+ZslhywByAByIxTalZSVVUZqjqKM1tEYramrraajqWuor0elGuiP
45
+ NTQyNDYyHWtmam5hYWlpbrXI2sbG2pZGo9nZ29s5ODiUOTo6Obs4jRs3rnz8+AnjJ06Y5OrmNtnd
46
+ 3d3D09PD8xyd7kX3uuDt7ePr6+t72c/f3z/APzAw8FpQUHAwI3jKlJCQkJuhoczQqVOn1oeFhYdP
47
+ mzZ9+vS7ERGRkVHR0dHRjTNmzGiKiYmNi4ubOZPFio+Pf5yQwGZzOImJSUnJSclt3FmzZs3m8Xgp
48
+ qampaal8fjpfIBAKRcKMjMzMOXPmzs3Kmj8/O3vBgoULc3IW5SxevERmyZKlS5ct++GH5XLLl69Y
49
+ 8eOPK1euGr5q1erVa9asXbuOsm5dXt56lfXrN2zYuPG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rvbLtYnbGlfUJLFSaFheBX0tsv5Yuhq
170
+ Lr6kbrmizibnWSaq/luydUK54MRKayKCoighCdce5vupMIjpUixMz7WQPabqTUR9ysdFbTYW2vfT
171
+ NkVUw2hZ5RxozkOF6VZTLvSxKXAXAugWqnjvPdEvYTM9G8gzTALHVq6i2nBWhO0WNygFIYU2+mMi
172
+ zfTM0yBQ0Nt45VnTxzfkCCGEkP+MFhTnEUZEQgghZ2QPiqf+agwhhJDTMjdL8QgjIiGEkJPSgiIj
173
+ IiGEkBPR1oUYFBkRCSGEnIh9szSO8MkaQgghp4PPmhJCCCGLg2dNr9frLLHAAgsssMDCP114F/v2
174
+ qT49PX2goYfcnp9vt1t8YWKIXD5d5icV7i/3y+f1rZz5w62/a+R+fxnj8jeGRwghhIjIzx/fv3z9
175
+ Nsu/AHusfoLn8h+6AAAAAElFTkSuQmCC
176
+
177
+ --Apple-Mail-5-305464934--
data/test/kcode.rb ADDED
@@ -0,0 +1,14 @@
1
+ module Test
2
+ module Unit
3
+ class TestCase
4
+ def kcode(code)
5
+ begin
6
+ TMail.KCODE = code
7
+ yield
8
+ ensure
9
+ TMail.KCODE = 'NONE'
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,46 @@
1
+ $:.unshift File.dirname(__FILE__)
2
+ require 'test_helper'
3
+ require 'tmail'
4
+ require 'kcode'
5
+ require 'time'
6
+
7
+ class TestMail < Test::Unit::TestCase
8
+ include TMail::TextUtils
9
+
10
+ def setup
11
+ @mail = TMail::Mail.new
12
+ end
13
+
14
+ def lf( str )
15
+ str.gsub(/\n|\r\n|\r/) { "\n" }
16
+ end
17
+
18
+ def crlf( str )
19
+ str.gsub(/\n|\r\n|\r/) { "\r\n" }
20
+ end
21
+
22
+ def test_MIME
23
+ # FIXME: test more.
24
+
25
+ kcode('EUC') {
26
+ mail = TMail::Mail.parse('From: hoge@example.jp (=?iso-2022-jp?B?GyRCJUYlOSVIGyhC?=)')
27
+ assert_not_nil mail['From']
28
+
29
+ expected = "\245\306\245\271\245\310"
30
+ if expected.respond_to? :force_encoding
31
+ expected.force_encoding(mail['From'].comments.first.encoding)
32
+ end
33
+ assert_equal [expected], mail['From'].comments
34
+
35
+ expected = "From: hoge@example.jp (\245\306\245\271\245\310)\n\n"
36
+ expected.force_encoding 'EUC-JP' if expected.respond_to? :force_encoding
37
+ assert_equal expected, mail.to_s
38
+ assert_equal expected, mail.decoded
39
+
40
+ expected = "From: hoge@example.jp (=?iso-2022-jp?B?GyRCJUYlOSVIGyhC?=)\r\n\r\n"
41
+ expected.force_encoding 'EUC-JP' if expected.respond_to? :force_encoding
42
+ assert_equal expected, mail.encoded
43
+ }
44
+ end
45
+
46
+ end