tmail 1.2.3.1 → 1.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. data/README +10 -0
  2. data/ext/tmailscanner/tmail/tmailscanner.c +39 -8
  3. data/lib/tmail.rb +1 -0
  4. data/lib/tmail/address.rb +6 -40
  5. data/lib/tmail/attachments.rb +41 -22
  6. data/lib/tmail/encode.rb +9 -0
  7. data/lib/tmail/header.rb +5 -3
  8. data/lib/tmail/interface.rb +40 -3
  9. data/lib/tmail/mail.rb +3 -3
  10. data/lib/tmail/mailbox.rb +3 -2
  11. data/lib/tmail/net.rb +3 -1
  12. data/lib/tmail/parser.rb +204 -620
  13. data/lib/tmail/parser.y +38 -3
  14. data/lib/tmail/quoting.rb +38 -1
  15. data/lib/tmail/utils.rb +28 -4
  16. data/lib/tmail/vendor/rchardet-1.3/COPYING +504 -0
  17. data/lib/tmail/vendor/rchardet-1.3/README +12 -0
  18. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet.rb +67 -0
  19. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/big5freq.rb +927 -0
  20. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/big5prober.rb +42 -0
  21. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/chardistribution.rb +237 -0
  22. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/charsetgroupprober.rb +112 -0
  23. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/charsetprober.rb +75 -0
  24. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/codingstatemachine.rb +64 -0
  25. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/constants.rb +42 -0
  26. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/escprober.rb +90 -0
  27. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/escsm.rb +244 -0
  28. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/eucjpprober.rb +88 -0
  29. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/euckrfreq.rb +596 -0
  30. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/euckrprober.rb +42 -0
  31. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/euctwfreq.rb +430 -0
  32. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/euctwprober.rb +42 -0
  33. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312freq.rb +474 -0
  34. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312prober.rb +42 -0
  35. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/hebrewprober.rb +289 -0
  36. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/jisfreq.rb +570 -0
  37. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/jpcntx.rb +229 -0
  38. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langbulgarianmodel.rb +229 -0
  39. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langcyrillicmodel.rb +330 -0
  40. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langgreekmodel.rb +227 -0
  41. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langhebrewmodel.rb +202 -0
  42. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langhungarianmodel.rb +226 -0
  43. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langthaimodel.rb +201 -0
  44. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/latin1prober.rb +147 -0
  45. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/mbcharsetprober.rb +89 -0
  46. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/mbcsgroupprober.rb +47 -0
  47. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/mbcssm.rb +542 -0
  48. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/sbcharsetprober.rb +124 -0
  49. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/sbcsgroupprober.rb +58 -0
  50. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/sjisprober.rb +88 -0
  51. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/universaldetector.rb +166 -0
  52. data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/utf8prober.rb +87 -0
  53. data/lib/tmail/version.rb +1 -1
  54. data/setup.rb +2 -2
  55. data/test/fixtures/apple_unquoted_content_type +44 -0
  56. data/test/fixtures/inline_attachment.txt +2095 -0
  57. data/test/fixtures/iso_8859_1_email_without_encoding_and_message_id.txt +16 -0
  58. data/test/fixtures/mailbox.zip +0 -0
  59. data/test/fixtures/marked_as_iso_8859_1_but_it_is_utf_8.txt +33 -0
  60. data/test/fixtures/marked_as_utf_8_but_it_is_iso_8859_1.txt +56 -0
  61. data/test/fixtures/raw_email_bad_time +62 -0
  62. data/test/fixtures/raw_email_double_at_in_header +14 -0
  63. data/test/fixtures/raw_email_only_attachment +17 -0
  64. data/test/fixtures/raw_email_string_in_date_field +17 -0
  65. data/test/fixtures/raw_email_trailing_dot +21 -0
  66. data/test/fixtures/raw_email_with_quoted_attachment_filename +60 -0
  67. data/test/fixtures/raw_email_with_wrong_splitted_multibyte_encoded_word_subject +15 -0
  68. data/test/fixtures/the_only_part_is_a_word_document.txt +425 -0
  69. data/test/fixtures/unquoted_filename_in_attachment +177 -0
  70. data/test/test_address.rb +114 -92
  71. data/test/test_attachments.rb +84 -1
  72. data/test/test_encode.rb +54 -0
  73. data/test/test_header.rb +60 -2
  74. data/test/test_mail.rb +22 -15
  75. data/test/test_mbox.rb +12 -3
  76. data/test/test_port.rb +13 -9
  77. data/test/test_quote.rb +9 -0
  78. data/tmail.gemspec +34 -0
  79. metadata +68 -167
  80. data/MANIFEST +0 -191
  81. data/log/BugTrackingLog.txt +0 -1231
  82. data/log/Changelog.txt +0 -534
  83. data/log/Fixme.txt +0 -6
  84. data/log/Testlog.txt +0 -2340
  85. data/log/Todo.txt +0 -30
  86. data/log/fixme.rdoc +0 -6
  87. data/meta/MANIFEST +0 -128
  88. data/meta/VERSION +0 -1
  89. data/meta/project.yaml +0 -30
  90. data/meta/unixname +0 -1
  91. data/sample/bench_base64.rb +0 -48
  92. data/sample/data/multipart +0 -23
  93. data/sample/data/normal +0 -29
  94. data/sample/data/sendtest +0 -5
  95. data/sample/data/simple +0 -14
  96. data/sample/data/test +0 -27
  97. data/sample/extract-attachements.rb +0 -33
  98. data/sample/from-check.rb +0 -26
  99. data/sample/multipart.rb +0 -26
  100. data/sample/parse-bench.rb +0 -68
  101. data/sample/parse-test.rb +0 -19
  102. data/sample/sendmail.rb +0 -94
  103. data/site/contributing/index.html +0 -183
  104. data/site/css/clean.css +0 -27
  105. data/site/css/layout.css +0 -31
  106. data/site/css/style.css +0 -60
  107. data/site/download/index.html +0 -61
  108. data/site/img/envelope.jpg +0 -0
  109. data/site/img/mailman.gif +0 -0
  110. data/site/img/stamp-sm.jpg +0 -0
  111. data/site/img/stamp.jpg +0 -0
  112. data/site/img/stampborder.jpg +0 -0
  113. data/site/img/tfire.jpg +0 -0
  114. data/site/img/tmail.png +0 -0
  115. data/site/index.html +0 -270
  116. data/site/js/jquery.js +0 -31
  117. data/site/log/Changelog.xsl +0 -33
  118. data/site/log/changelog.xml +0 -1677
  119. data/site/outdated/BUGS +0 -3
  120. data/site/outdated/DEPENDS +0 -1
  121. data/site/outdated/Incompatibilities +0 -89
  122. data/site/outdated/Incompatibilities.ja +0 -102
  123. data/site/outdated/NEWS +0 -9
  124. data/site/outdated/README.ja +0 -73
  125. data/site/outdated/doc.ja/address.html +0 -275
  126. data/site/outdated/doc.ja/basics.html +0 -405
  127. data/site/outdated/doc.ja/config.html +0 -49
  128. data/site/outdated/doc.ja/details.html +0 -146
  129. data/site/outdated/doc.ja/index.html +0 -39
  130. data/site/outdated/doc.ja/mail.html +0 -793
  131. data/site/outdated/doc.ja/mailbox.html +0 -265
  132. data/site/outdated/doc.ja/port.html +0 -95
  133. data/site/outdated/doc.ja/tmail.html +0 -58
  134. data/site/outdated/doc.ja/usage.html +0 -202
  135. data/site/outdated/rdd/address.rrd.m +0 -229
  136. data/site/outdated/rdd/basics.rd.m +0 -275
  137. data/site/outdated/rdd/config.rrd.m +0 -26
  138. data/site/outdated/rdd/details.rd.m +0 -117
  139. data/site/outdated/rdd/index.rhtml.m +0 -54
  140. data/site/outdated/rdd/mail.rrd.m +0 -701
  141. data/site/outdated/rdd/mailbox.rrd.m +0 -228
  142. data/site/outdated/rdd/port.rrd.m +0 -69
  143. data/site/outdated/rdd/tmail.rrd.m +0 -33
  144. data/site/outdated/rdd/usage.rd.m +0 -247
  145. data/site/quickstart/index.html +0 -69
  146. data/site/quickstart/quickstart.html +0 -52
  147. data/site/quickstart/usage.html +0 -193
  148. data/site/reference/address.html +0 -247
  149. data/site/reference/config.html +0 -30
  150. data/site/reference/index.html +0 -101
  151. data/site/reference/mail.html +0 -726
  152. data/site/reference/mailbox.html +0 -245
  153. data/site/reference/port.html +0 -75
  154. data/site/reference/tmail.html +0 -35
  155. data/work/script/make +0 -26
  156. data/work/script/rdoc +0 -39
  157. data/work/script/setup +0 -1616
  158. data/work/script/test +0 -30
@@ -65,12 +65,14 @@ class TestEncode < Test::Unit::TestCase
65
65
  "=?iso-2022-jp?B?YRskQiQiGyhCYSBhGyRCJCIbKEJhIGEbJEIkIhsoQmEgYRskQiQiGyhCYSBh?=\r\n\t=?iso-2022-jp?B?GyRCJCIbKEJhIGEbJEIkIhsoQmE=?=" #26
66
66
  ]
67
67
 
68
+ unless RUBY_VERSION.match(/1.9/)
68
69
  def test_s_encode
69
70
  SRCS.each_index do |i|
70
71
  assert_equal crlf(OK[i]),
71
72
  TMail::Encoder.encode(NKF.nkf('-j', SRCS[i]))
72
73
  end
73
74
  end
75
+ end
74
76
 
75
77
  def crlf( str )
76
78
  str.gsub(/\n|\r\n|\r/) { "\r\n" }
@@ -82,4 +84,56 @@ class TestEncode < Test::Unit::TestCase
82
84
  assert_nothing_raised(Exception) { mail.encoded }
83
85
  end
84
86
 
87
+ # =?utf-8?Q? Nicolas=20Fouch=E9?= is not UTF-8, it's ISO-8859-1 !
88
+ def test_marked_as_utf_8_but_it_is_iso_8859_1
89
+ mail = load_fixture('marked_as_utf_8_but_it_is_iso_8859_1.txt')
90
+
91
+ name = mail.to_addrs.first.name
92
+ assert_equal ' Nicolas Fouché', TMail::Unquoter.unquote_and_convert_to(name, 'utf-8')
93
+
94
+ # Without the patch, TMail raises:
95
+ # Iconv::InvalidCharacter: "\351"
96
+ # method iconv in quoting.rb at line 99
97
+ # method convert_to in quoting.rb at line 99
98
+ # method unquote_quoted_printable_and_convert_to in quoting.rb at line 88
99
+ # method unquote_and_convert_to in quoting.rb at line 72
100
+ # method gsub in quoting.rb at line 63
101
+ # method unquote_and_convert_to in quoting.rb at line 63
102
+ end
103
+
104
+ # =?iso-8859-1?b?77y5772B772O772Q772J772O772HIA==?= =?iso-8859-1?b?77y377yh77yu77yn?= is not ISO-8859-1, it's UTF-8 !
105
+ def test_marked_as_iso_8859_1_but_it_is_utf_8
106
+ mail = load_fixture('marked_as_iso_8859_1_but_it_is_utf_8.txt')
107
+
108
+ name = mail.to_addrs.first.name
109
+ assert_equal 'Yanping WANG', TMail::Unquoter.unquote_and_convert_to(name, 'utf-8')
110
+ # Even GMail could not detect this one :)
111
+
112
+ # Without the patch, TMail returns: "Yanping WANG"
113
+ end
114
+
115
+ # Be sure not to copy/paste the content of the fixture to another file, it could be automatically converted to utf-8
116
+ def test_iso_8859_1_email_without_encoding_and_message_id
117
+ mail = load_fixture('iso_8859_1_email_without_encoding_and_message_id.txt')
118
+
119
+ text = TMail::Unquoter.unquote_and_convert_to(mail.body, 'utf-8')
120
+
121
+ assert(text.include?('é'), 'Text content should include the "é" character')
122
+
123
+ # I'm not very proud of this one, chardet detects iso-8859-2, so I have to force the encoding to iso-8859-1.
124
+ assert(!text.include?('ŕ'), 'Text content should not iso-8859-2, "ŕ" should be "à"')
125
+
126
+ # Without the patch, TMail::Unquoter.unquote_and_convert_to returns:
127
+ # Il semblerait que vous n'ayez pas consult� votre messagerie depuis plus
128
+ # d'un an. Aussi, celle-ci a �t� temporairement desactiv�e.
129
+ # Aucune demande n'est necessaire pour r�activer votre messagerie : la simple
130
+ # consultation de ce message indique que la boite est � nouveau utilisable.
131
+ end
132
+
133
+ protected
134
+
135
+ def load_fixture(name)
136
+ TMail::Mail.load(File.join('test', 'fixtures', name))
137
+ end
138
+
85
139
  end
@@ -244,6 +244,14 @@ class MessageIdHeaderTester < Test::Unit::TestCase
244
244
  end
245
245
  end
246
246
 
247
+ def test_message_id_double_at
248
+ %w( Message-Id MESSAGE-ID Message-ID
249
+ Resent-Message-Id Content-Id ).each do |name|
250
+ h = TMail::HeaderField.new(name, '<20020103xg88.k0@mail@me.loveruby.net>')
251
+ assert_instance_of TMail::MessageIdHeader, h
252
+ end
253
+ end
254
+
247
255
  def test_id
248
256
  str = '<20020103xg88.k0@mail.loveruby.net>'
249
257
  h = TMail::HeaderField.new('Message-Id', str)
@@ -263,6 +271,13 @@ class MessageIdHeaderTester < Test::Unit::TestCase
263
271
  assert_not_nil h.id
264
272
  assert_equal str, h.id
265
273
  end
274
+
275
+ def test_double_at_in_header
276
+ fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email_double_at_in_header")
277
+ str = '<d3b8cf8e49f0448085@0c28713a1@f473e@37signals.com>'
278
+ mail = TMail::Mail.parse(fixture)
279
+ assert_equal str, mail.message_id
280
+ end
266
281
  end
267
282
 
268
283
  class ReferencesHeaderTester < Test::Unit::TestCase
@@ -755,8 +770,8 @@ class ContentDispositionHeaderTester < Test::Unit::TestCase
755
770
  #_test_rfc2231_encode
756
771
  _test_raw_iso2022jp
757
772
  _test_raw_eucjp
758
- _test_raw_sjis
759
- _test_code_conversion
773
+ _test_raw_sjis unless RUBY_VERSION.match(/1.9/)
774
+ _test_code_conversion unless RUBY_VERSION.match(/1.9/)
760
775
  ensure
761
776
  TMail.KCODE = 'NONE'
762
777
  end
@@ -959,5 +974,48 @@ class ContentDispositionHeaderTester < Test::Unit::TestCase
959
974
  h = TMail::HeaderField.new_from_port(p, 'Received-Long-Header')
960
975
  assert_equal(h, nil)
961
976
  end
977
+
978
+ def test_multi_address_header_in_tmail
979
+ h = TMail::Mail.new
980
+ h.to = "Mikel@me.com, mikel@you.com"
981
+ assert_equal("To: Mikel@me.com,\r\n\t mikel@you.com\r\n\r\n", h.encoded)
982
+ end
983
+
984
+ def test_adding_custom_message_id
985
+ fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email")
986
+ mail = TMail::Mail.parse(fixture)
987
+ message_id = "<12345@me.com>"
988
+ mail.enforced_message_id = message_id
989
+ mail.ready_to_send
990
+ assert_equal(message_id, mail.message_id)
991
+ end
992
+
993
+ def test_not_adding_custom_message_id
994
+ fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email")
995
+ mail = TMail::Mail.parse(fixture)
996
+ message_id = mail.message_id
997
+ mail.message_id = "<12345@me.com>"
998
+ mail.ready_to_send
999
+ assert_not_equal(message_id, mail.message_id)
1000
+ end
1001
+
1002
+ def test_content_type_does_not_unquote_parameter_values
1003
+ japanese_jis_filename = "¥e$B4A;z¥e(B.jpg"
1004
+ mailsrc =<<ENDSTRING
1005
+ Content-Type: image/jpeg;
1006
+ name="#{japanese_jis_filename}"
1007
+ Content-Transfer-Encoding: Base64
1008
+ Content-Disposition: attachment
1009
+ ENDSTRING
1010
+ result =<<ENDSTRING
1011
+ Content-Type: image/jpeg; name*=iso-2022-jp'ja'%c2%a5e$B4A%3bz%c2%a5e%28B.jpg
1012
+ Content-Transfer-Encoding: Base64
1013
+ Content-Disposition: attachment
1014
+
1015
+ ENDSTRING
1016
+
1017
+ mail = TMail::Mail.parse(mailsrc)
1018
+ assert_equal(result.gsub("\n", "\r\n"), mail.encoded)
1019
+ end
962
1020
 
963
1021
  end
@@ -416,6 +416,22 @@ EOF
416
416
  assert_equal "VGhlIGJvZHk=", mail.quoted_body.strip
417
417
  end
418
418
 
419
+ def test_unquote_base64_body_with_invalid_charset
420
+ msg = <<EOF
421
+ From: "2009-07-02 21:53:01" <sender@example.com>
422
+ Subject: unqoute base64 body with invalid charset
423
+ MIME-Version: 1.0
424
+ charset="gb2312"
425
+ Content-Transfer-Encoding: base64
426
+
427
+ RGVhciBTaXJzLCANCldlIGFyZSBnaXZlbiB0byB1bmRlcnN0YW5kIHRoYXQg
428
+ eW91IGFyZSAgTWFudWZhY3R1cmVyIG9mICBwbHN0aWMgIEJvdHRsZXMNCkFk
429
+ ZKO6IGJsYWggQ2hpbmE=
430
+ EOF
431
+ mail = TMail::Mail.parse(msg)
432
+ assert_equal "Dear Sirs, \r\nWe are given to understand that you are Manufacturer of plstic Bottles\r\nAdd: blah China", mail.body.strip
433
+ end
434
+
419
435
  def test_message_id
420
436
  assert_nil @mail.message_id
421
437
  assert_equal 1, @mail.message_id(1)
@@ -423,6 +439,9 @@ EOF
423
439
  m = '<very.unique.identity@fully.quorified.domain.name>'
424
440
  @mail.message_id = m
425
441
  assert_equal m, @mail.message_id
442
+
443
+ @mail.message_id = 'this_is_my_badly_formatted_message_id'
444
+ assert_equal nil, @mail.message_id
426
445
  end
427
446
 
428
447
  def test_in_reply_to
@@ -498,7 +517,7 @@ EOF
498
517
  output = <<EOF
499
518
  From: mikel@example.com
500
519
  Subject: Hello
501
- #{if RUBY_VERSION < '1.9'
520
+ #{if RUBY_VERSION < '1.8.7'
502
521
  'Content-Type: multipart/signed; protocol="application/pkcs7-signature"; boundary=Apple-Mail-42-587703407; micalg=sha1'
503
522
  else
504
523
  'Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-42-587703407; protocol="application/pkcs7-signature"'
@@ -731,19 +750,7 @@ EOF
731
750
  part = TMail::Mail.parse("Content-Type: text/plain\n\nBlah")
732
751
  mail.parts << part
733
752
  mail.preamble = 'This is the preamble'
734
- # normalize the boundary to something non-random to assert against
735
- str = mail.encoded
736
- result = str.gsub(str[/boundary="(.*?)"/, 1], 'boundary')
737
- expected =<<EOF
738
- Content-Type: multipart/mixed; boundary="boundary"
739
-
740
- This is the preamble
741
- --boundary
742
- Content-Type: text/plain
743
-
744
- Blah
745
- --boundary--
746
- EOF
747
- assert_equal(crlf(expected), result)
753
+ assert(mail.encoded =~ /\r\n\r\nThis is the preamble\r\n--mimepart/)
748
754
  end
755
+
749
756
  end
@@ -9,8 +9,8 @@ class MailboxTester < Test::Unit::TestCase
9
9
  N = 5
10
10
 
11
11
  def setup
12
- rm_rf MAILBOX
13
- mkdir MAILBOX
12
+ rm_rf(MAILBOX, :verbose => false)
13
+ mkdir(MAILBOX, :verbose => false)
14
14
  N.downto(1) do |i|
15
15
  File.open( "#{MAILBOX}/#{i}", 'w' ) {|f|
16
16
  f.puts 'From: aamine'
@@ -35,7 +35,7 @@ class MailboxTester < Test::Unit::TestCase
35
35
  end
36
36
 
37
37
  def teardown
38
- rm_rf MAILBOX
38
+ rm_rf(MAILBOX, :verbose => false)
39
39
  end
40
40
 
41
41
  def test_s_new
@@ -172,4 +172,13 @@ class MailboxTester < Test::Unit::TestCase
172
172
  File.delete(filename)
173
173
  end
174
174
 
175
+ def test_fromline2time_should_return_nil_on_out_of_range_dates
176
+ filename = "#{File.dirname(__FILE__)}/fixtures/mailbox"
177
+ FileUtils.copy(filename, "#{filename}_test")
178
+ filename = "#{filename}_test"
179
+ line = "From mikel mikel March 24 01:02:03 1900"
180
+ mailbox = TMail::UNIXMbox.new(filename, nil, false)
181
+ assert_equal(nil, mailbox.send(:fromline2time, line))
182
+ end
183
+
175
184
  end
@@ -7,8 +7,8 @@ class FilePortTester < Test::Unit::TestCase
7
7
  include FileUtils
8
8
 
9
9
  def setup
10
- rm_rf 'tmp'
11
- mkdir 'tmp'
10
+ rm_rf('tmp', :verbose => false)
11
+ mkdir('tmp', :verbose => false)
12
12
  5.times do |n|
13
13
  File.open('tmp/' + n.to_s, 'w') {|f|
14
14
  f.puts "file #{n}"
@@ -17,7 +17,7 @@ class FilePortTester < Test::Unit::TestCase
17
17
  end
18
18
 
19
19
  def teardown
20
- rm_rf 'tmp'
20
+ rm_rf('tmp', :verbose => false)
21
21
  end
22
22
 
23
23
  def test_s_new
@@ -336,8 +336,9 @@ class MhPortTester < Test::Unit::TestCase
336
336
  include FileUtils
337
337
 
338
338
  def setup
339
- rm_rf 'tmp'
340
- mkdir 'tmp'
339
+ rm_rf('tmp', :verbose => false)
340
+
341
+ mkdir('tmp', :verbose => false)
341
342
  3.times do |n|
342
343
  File.open( "tmp/#{n}", 'w' ) {|f|
343
344
  f.puts 'From: Minero Aoki <aamine@loveruby.net>'
@@ -349,7 +350,8 @@ class MhPortTester < Test::Unit::TestCase
349
350
  end
350
351
 
351
352
  def teardown
352
- rm_rf 'tmp'
353
+ rm_rf('tmp', :verbose => false)
354
+
353
355
  end
354
356
 
355
357
  def test_flags
@@ -387,8 +389,9 @@ class MaildirPortTester < Test::Unit::TestCase
387
389
  include FileUtils
388
390
 
389
391
  def setup
390
- rm_rf 'tmp'
391
- mkdir 'tmp'
392
+ rm_rf('tmp', :verbose => false)
393
+
394
+ mkdir('tmp', :verbose => false)
392
395
  3.times do |n|
393
396
  File.open( "tmp/000.00#{n}.a", 'w' ) {|f|
394
397
  f.puts 'From: Minero Aoki <aamine@loveruby.net>'
@@ -400,7 +403,8 @@ class MaildirPortTester < Test::Unit::TestCase
400
403
  end
401
404
 
402
405
  def teardown
403
- rm_rf 'tmp'
406
+ rm_rf('tmp', :verbose => false)
407
+
404
408
  end
405
409
 
406
410
  def test_flags
@@ -33,6 +33,15 @@ class TestQuote < Test::Unit::TestCase
33
33
  expected.force_encoding 'utf-8' if expected.respond_to? :force_encoding
34
34
  assert_equal expected, b
35
35
  end
36
+
37
+ # See section 8 of http://www.faqs.org/rfcs/rfc2047.html
38
+ def test_unquote_multiple_separated_by_whitespace
39
+ a ="=?utf-8?Q?hello?= =?utf-8?Q?there?="
40
+ b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
41
+ expected = "hellothere"
42
+ expected.force_encoding 'utf-8' if expected.respond_to? :force_encoding
43
+ assert_equal expected, b
44
+ end
36
45
 
37
46
  def test_unqoute_in_the_middle
38
47
  a ="Re: Photos =?ISO-8859-1?Q?Brosch=FCre_Rand?="
@@ -0,0 +1,34 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{tmail}
5
+ s.version = "1.2.6"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Mikel Lindsaar <raasdnil AT gmail.com>"]
9
+ s.date = %q{2010-01-06}
10
+ s.description = %q{TMail is a Ruby-based mail handler. It allows you to compose stadards compliant emails in a very Ruby-way.}
11
+ s.email = %q{raasdnil AT gmail.com}
12
+ s.extensions = ["ext/tmailscanner/tmail/extconf.rb"]
13
+ s.extra_rdoc_files = ["README", "CHANGES", "LICENSE", "NOTES", "Rakefile"]
14
+ s.files = %w(README Rakefile NOTES CHANGES LICENSE setup.rb tmail.gemspec) +
15
+ Dir.glob("lib/**/*") + Dir.glob("ext/**/*")
16
+ s.has_rdoc = true
17
+ s.homepage = %q{http://tmail.rubyforge.org}
18
+ s.rdoc_options = ["--inline-source", "--title", "TMail", "--main", "README"]
19
+ s.require_paths = ["lib", "ext/tmailscanner"]
20
+ s.rubyforge_project = %q{tmail}
21
+ s.rubygems_version = %q{1.3.1}
22
+ s.summary = %q{Ruby Mail Handler}
23
+ s.test_files = Dir.glob("test/**/*")
24
+
25
+ if s.respond_to? :specification_version then
26
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
27
+ s.specification_version = 2
28
+
29
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
30
+ else
31
+ end
32
+ else
33
+ end
34
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tmail
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3.1
4
+ version: 1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikel Lindsaar <raasdnil AT gmail.com>
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-04-11 00:00:00 +10:00
12
+ date: 2010-01-06 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -23,22 +23,16 @@ extra_rdoc_files:
23
23
  - README
24
24
  - CHANGES
25
25
  - LICENSE
26
- - MANIFEST
27
26
  - NOTES
28
27
  - Rakefile
29
28
  files:
29
+ - README
30
+ - Rakefile
31
+ - NOTES
30
32
  - CHANGES
31
- - doc
32
- - ext
33
- - ext/Makefile
34
- - ext/tmailscanner
35
- - ext/tmailscanner/tmail
36
- - ext/tmailscanner/tmail/depend
37
- - ext/tmailscanner/tmail/extconf.rb
38
- - ext/tmailscanner/tmail/MANIFEST
39
- - ext/tmailscanner/tmail/tmailscanner.c
40
- - lib
41
- - lib/tmail
33
+ - LICENSE
34
+ - setup.rb
35
+ - tmail.gemspec
42
36
  - lib/tmail/address.rb
43
37
  - lib/tmail/attachments.rb
44
38
  - lib/tmail/base64.rb
@@ -66,161 +60,54 @@ files:
66
60
  - lib/tmail/scanner_r.rb
67
61
  - lib/tmail/stringio.rb
68
62
  - lib/tmail/utils.rb
63
+ - lib/tmail/vendor/rchardet-1.3/COPYING
64
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/big5freq.rb
65
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/big5prober.rb
66
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/chardistribution.rb
67
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/charsetgroupprober.rb
68
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/charsetprober.rb
69
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/codingstatemachine.rb
70
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/constants.rb
71
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/escprober.rb
72
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/escsm.rb
73
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/eucjpprober.rb
74
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/euckrfreq.rb
75
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/euckrprober.rb
76
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/euctwfreq.rb
77
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/euctwprober.rb
78
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312freq.rb
79
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312prober.rb
80
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/hebrewprober.rb
81
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/jisfreq.rb
82
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/jpcntx.rb
83
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/langbulgarianmodel.rb
84
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/langcyrillicmodel.rb
85
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/langgreekmodel.rb
86
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/langhebrewmodel.rb
87
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/langhungarianmodel.rb
88
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/langthaimodel.rb
89
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/latin1prober.rb
90
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/mbcharsetprober.rb
91
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/mbcsgroupprober.rb
92
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/mbcssm.rb
93
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/sbcharsetprober.rb
94
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/sbcsgroupprober.rb
95
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/sjisprober.rb
96
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/universaldetector.rb
97
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet/utf8prober.rb
98
+ - lib/tmail/vendor/rchardet-1.3/lib/rchardet.rb
99
+ - lib/tmail/vendor/rchardet-1.3/README
69
100
  - lib/tmail/version.rb
70
101
  - lib/tmail.rb
71
- - LICENSE
72
- - log
73
- - log/BugTrackingLog.txt
74
- - log/Changelog.txt
75
- - log/fixme.rdoc
76
- - log/Fixme.txt
77
- - log/Testlog.txt
78
- - log/Todo.txt
79
- - meta
80
- - meta/MANIFEST
81
- - meta/project.yaml
82
- - meta/unixname
83
- - meta/VERSION
84
- - NOTES
85
- - Rakefile
86
- - README
87
- - sample
88
- - sample/bench_base64.rb
89
- - sample/data
90
- - sample/data/multipart
91
- - sample/data/normal
92
- - sample/data/sendtest
93
- - sample/data/simple
94
- - sample/data/test
95
- - sample/extract-attachements.rb
96
- - sample/from-check.rb
97
- - sample/multipart.rb
98
- - sample/parse-bench.rb
99
- - sample/parse-test.rb
100
- - sample/sendmail.rb
101
- - setup.rb
102
- - site
103
- - site/contributing
104
- - site/contributing/index.html
105
- - site/css
106
- - site/css/clean.css
107
- - site/css/layout.css
108
- - site/css/style.css
109
- - site/download
110
- - site/download/index.html
111
- - site/img
112
- - site/img/envelope.jpg
113
- - site/img/mailman.gif
114
- - site/img/stamp-sm.jpg
115
- - site/img/stamp.jpg
116
- - site/img/stampborder.jpg
117
- - site/img/tfire.jpg
118
- - site/img/tmail.png
119
- - site/index.html
120
- - site/js
121
- - site/js/jquery.js
122
- - site/log
123
- - site/log/changelog.xml
124
- - site/log/Changelog.xsl
125
- - site/outdated
126
- - site/outdated/BUGS
127
- - site/outdated/DEPENDS
128
- - site/outdated/doc.ja
129
- - site/outdated/doc.ja/address.html
130
- - site/outdated/doc.ja/basics.html
131
- - site/outdated/doc.ja/config.html
132
- - site/outdated/doc.ja/details.html
133
- - site/outdated/doc.ja/index.html
134
- - site/outdated/doc.ja/mail.html
135
- - site/outdated/doc.ja/mailbox.html
136
- - site/outdated/doc.ja/port.html
137
- - site/outdated/doc.ja/tmail.html
138
- - site/outdated/doc.ja/usage.html
139
- - site/outdated/Incompatibilities
140
- - site/outdated/Incompatibilities.ja
141
- - site/outdated/NEWS
142
- - site/outdated/rdd
143
- - site/outdated/rdd/address.rrd.m
144
- - site/outdated/rdd/basics.rd.m
145
- - site/outdated/rdd/config.rrd.m
146
- - site/outdated/rdd/details.rd.m
147
- - site/outdated/rdd/index.rhtml.m
148
- - site/outdated/rdd/mail.rrd.m
149
- - site/outdated/rdd/mailbox.rrd.m
150
- - site/outdated/rdd/port.rrd.m
151
- - site/outdated/rdd/tmail.rrd.m
152
- - site/outdated/rdd/usage.rd.m
153
- - site/outdated/README.ja
154
- - site/quickstart
155
- - site/quickstart/index.html
156
- - site/quickstart/quickstart.html
157
- - site/quickstart/usage.html
158
- - site/reference
159
- - site/reference/address.html
160
- - site/reference/config.html
161
- - site/reference/index.html
162
- - site/reference/mail.html
163
- - site/reference/mailbox.html
164
- - site/reference/port.html
165
- - site/reference/tmail.html
166
- - test
167
- - test/extctrl.rb
168
- - test/fixtures
169
- - test/fixtures/mailbox
170
- - test/fixtures/mailbox_without_any_from_or_sender
171
- - test/fixtures/mailbox_without_from
172
- - test/fixtures/mailbox_without_return_path
173
- - test/fixtures/raw_attack_email_with_zero_length_whitespace
174
- - test/fixtures/raw_base64_decoded_string
175
- - test/fixtures/raw_base64_email
176
- - test/fixtures/raw_base64_encoded_string
177
- - test/fixtures/raw_email
178
- - test/fixtures/raw_email10
179
- - test/fixtures/raw_email11
180
- - test/fixtures/raw_email12
181
- - test/fixtures/raw_email13
182
- - test/fixtures/raw_email2
183
- - test/fixtures/raw_email3
184
- - test/fixtures/raw_email4
185
- - test/fixtures/raw_email5
186
- - test/fixtures/raw_email6
187
- - test/fixtures/raw_email7
188
- - test/fixtures/raw_email8
189
- - test/fixtures/raw_email9
190
- - test/fixtures/raw_email_multiple_from
191
- - test/fixtures/raw_email_quoted_with_0d0a
192
- - test/fixtures/raw_email_reply
193
- - test/fixtures/raw_email_simple
194
- - test/fixtures/raw_email_with_bad_date
195
- - test/fixtures/raw_email_with_illegal_boundary
196
- - test/fixtures/raw_email_with_mimepart_without_content_type
197
- - test/fixtures/raw_email_with_multipart_mixed_quoted_boundary
198
- - test/fixtures/raw_email_with_nested_attachment
199
- - test/fixtures/raw_email_with_partially_quoted_subject
200
- - test/fixtures/raw_email_with_quoted_illegal_boundary
201
- - test/kcode.rb
202
- - test/temp_test_one.rb
203
- - test/test_address.rb
204
- - test/test_attachments.rb
205
- - test/test_base64.rb
206
- - test/test_encode.rb
207
- - test/test_header.rb
208
- - test/test_helper.rb
209
- - test/test_mail.rb
210
- - test/test_mbox.rb
211
- - test/test_port.rb
212
- - test/test_quote.rb
213
- - test/test_scanner.rb
214
- - test/test_utils.rb
215
- - work
216
- - work/script
217
- - work/script/make
218
- - work/script/rdoc
219
- - work/script/setup
220
- - work/script/test
221
- - MANIFEST
102
+ - ext/Makefile
103
+ - ext/tmailscanner/tmail/depend
104
+ - ext/tmailscanner/tmail/extconf.rb
105
+ - ext/tmailscanner/tmail/MANIFEST
106
+ - ext/tmailscanner/tmail/tmailscanner.c
222
107
  has_rdoc: true
223
108
  homepage: http://tmail.rubyforge.org
109
+ licenses: []
110
+
224
111
  post_install_message:
225
112
  rdoc_options:
226
113
  - --inline-source
@@ -246,17 +133,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement
246
133
  requirements: []
247
134
 
248
135
  rubyforge_project: tmail
249
- rubygems_version: 1.1.0
136
+ rubygems_version: 1.3.5
250
137
  signing_key:
251
138
  specification_version: 2
252
139
  summary: Ruby Mail Handler
253
140
  test_files:
254
141
  - test/extctrl.rb
255
- - test/fixtures
142
+ - test/fixtures/apple_unquoted_content_type
143
+ - test/fixtures/inline_attachment.txt
144
+ - test/fixtures/iso_8859_1_email_without_encoding_and_message_id.txt
256
145
  - test/fixtures/mailbox
146
+ - test/fixtures/mailbox.zip
257
147
  - test/fixtures/mailbox_without_any_from_or_sender
258
148
  - test/fixtures/mailbox_without_from
259
149
  - test/fixtures/mailbox_without_return_path
150
+ - test/fixtures/marked_as_iso_8859_1_but_it_is_utf_8.txt
151
+ - test/fixtures/marked_as_utf_8_but_it_is_iso_8859_1.txt
260
152
  - test/fixtures/raw_attack_email_with_zero_length_whitespace
261
153
  - test/fixtures/raw_base64_decoded_string
262
154
  - test/fixtures/raw_base64_email
@@ -274,17 +166,26 @@ test_files:
274
166
  - test/fixtures/raw_email7
275
167
  - test/fixtures/raw_email8
276
168
  - test/fixtures/raw_email9
169
+ - test/fixtures/raw_email_bad_time
170
+ - test/fixtures/raw_email_double_at_in_header
277
171
  - test/fixtures/raw_email_multiple_from
172
+ - test/fixtures/raw_email_only_attachment
278
173
  - test/fixtures/raw_email_quoted_with_0d0a
279
174
  - test/fixtures/raw_email_reply
280
175
  - test/fixtures/raw_email_simple
176
+ - test/fixtures/raw_email_string_in_date_field
177
+ - test/fixtures/raw_email_trailing_dot
281
178
  - test/fixtures/raw_email_with_bad_date
282
179
  - test/fixtures/raw_email_with_illegal_boundary
283
180
  - test/fixtures/raw_email_with_mimepart_without_content_type
284
181
  - test/fixtures/raw_email_with_multipart_mixed_quoted_boundary
285
182
  - test/fixtures/raw_email_with_nested_attachment
286
183
  - test/fixtures/raw_email_with_partially_quoted_subject
184
+ - test/fixtures/raw_email_with_quoted_attachment_filename
287
185
  - test/fixtures/raw_email_with_quoted_illegal_boundary
186
+ - test/fixtures/raw_email_with_wrong_splitted_multibyte_encoded_word_subject
187
+ - test/fixtures/the_only_part_is_a_word_document.txt
188
+ - test/fixtures/unquoted_filename_in_attachment
288
189
  - test/kcode.rb
289
190
  - test/temp_test_one.rb
290
191
  - test/test_address.rb