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
@@ -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+vS7ER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fhC3J04fVyW3qoL1pymhSZePdheOr/rlSxyNbCwaIwVnDV2OiW8MVDRdLrxcuO
168
+ a7Rmmr/2PO8B5FBSSt5omIpLwG/75VtHamYg2HzXESqG9xZvM+SZZ4pgzBK31uLQq2wxtY1ZGrHW
169
+ 0kpedS4ry/fjMf/RrURu7j2q24mgEqO7lVXDGx8RKnyp2rvbLtYnbGlfUJLFSaFheBX0tsv5Yuhq
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--
@@ -92,7 +92,7 @@ class TestAddress < Test::Unit::TestCase
92
92
  assert_equal ok[:address], a.spec, str.inspect + " (spec)\n"
93
93
  assert_equal ok[:local], a.local, str.inspect + " (local)\n"
94
94
  assert_equal ok[:domain], a.domain, str.inspect + " (domain)\n"
95
- # assert_equal ok[:format], a.to_s, str.inspect + " (to_s)\n"
95
+ #assert_equal ok[:format], a.to_s, str.inspect + " (to_s)\n"
96
96
  end
97
97
 
98
98
  def validate_case__group( str, groupname, addrlist )
@@ -153,22 +153,19 @@ class TestAddress < Test::Unit::TestCase
153
153
 
154
154
  end
155
155
 
156
- def test_parse__dot
157
- validate_case__address 'hoge..test@docomo.ne.jp',
158
- :display_name => nil,
159
- :address => 'hoge..test@docomo.ne.jp',
160
- :local => 'hoge..test',
161
- :domain => 'docomo.ne.jp',
162
- :format => 'hoge..test@docomo.ne.jp'
163
-
164
- validate_case__address 'foo.bar.@docomo.ne.jp',
165
- :display_name => nil,
166
- :address => 'foo.bar.@docomo.ne.jp',
167
- :local => 'foo.bar.',
168
- :domain => 'docomo.ne.jp',
169
- :format => 'foo.bar.@docomo.ne.jp'
156
+ def test_parse__dots
157
+ 1.upto(10) do |times|
158
+ dots = "." * times
159
+ validate_case__address "hoge#{dots}test@docomo.ne.jp",
160
+ :display_name => nil,
161
+ :address => "hoge#{dots}test@docomo.ne.jp",
162
+ :local => "hoge#{dots}test",
163
+ :domain => 'docomo.ne.jp',
164
+ :format => "hoge#{dots}test@docomo.ne.jp"
165
+ end
170
166
  end
171
167
 
168
+ unless RUBY_VERSION.match(/1.9/)
172
169
  def test_parse__mime
173
170
  # "\306\374\313\334\270\354"
174
171
  # "\223\372\226{\214\352"
@@ -230,6 +227,7 @@ class TestAddress < Test::Unit::TestCase
230
227
  :domain => 'loveruby.net',
231
228
  :format => '=?iso-2022-jp?B?GyRCRnxLXDhsGyhC?= <aamine@loveruby.net>'
232
229
  end
230
+ end
233
231
 
234
232
  def test_parse__rawjp
235
233
  begin
@@ -1091,32 +1089,8 @@ class TestAddress < Test::Unit::TestCase
1091
1089
 
1092
1090
  end
1093
1091
 
1094
- def test_quoted_at_char_in_local()
1095
-
1096
- validate_case__address\
1097
- %Q("@" <"@"@test>),
1098
- :name => "@",
1099
- :display_name => "@",
1100
- :address => %Q("@"@test),
1101
- :comments => nil,
1102
- :domain => 'test',
1103
- :local => %Q("@"),
1104
- :format => %Q("@" <"@"@test>)
1092
+ def test_dot_in_address()
1105
1093
 
1106
- validate_case__address\
1107
- %Q("@" <"me@me"@test>),
1108
- :name => "@",
1109
- :display_name => "@",
1110
- :address => %Q("me@me"@test),
1111
- :comments => nil,
1112
- :domain => 'test',
1113
- :local => %Q("me@me"),
1114
- :format => %Q("@" <"me@me"@test>)
1115
-
1116
- end
1117
-
1118
- def test_full_stop_as_last_char_in_display_name()
1119
-
1120
1094
  validate_case__address\
1121
1095
  %Q(Minero A. <aamine@loveruby.net>),
1122
1096
  :name => "Minero A.",
@@ -1127,68 +1101,116 @@ class TestAddress < Test::Unit::TestCase
1127
1101
  :local => %Q(aamine),
1128
1102
  :format => %Q("me@my_place" <aamine@loveruby.net>)
1129
1103
 
1104
+ validate_case__address\
1105
+ %Q(mikel . <mikel@lindsaar.net>),
1106
+ :name => "mikel .",
1107
+ :display_name => "mikel .",
1108
+ :address => %Q(mikel@lindsaar.net),
1109
+ :comments => nil,
1110
+ :domain => 'lindsaar.net',
1111
+ :local => %Q(mikel),
1112
+ :format => %Q("mikel ." <mikel@lindsaar.net>)
1113
+
1114
+ validate_case__address\
1115
+ %Q("mikel ." <mikel@lindsaar.net>),
1116
+ :name => "mikel .",
1117
+ :display_name => "mikel .",
1118
+ :address => %Q(mikel@lindsaar.net),
1119
+ :comments => nil,
1120
+ :domain => 'lindsaar.net',
1121
+ :local => %Q(mikel),
1122
+ :format => %Q("mikel ." <mikel@lindsaar.net>)
1123
+
1124
+ validate_case__address\
1125
+ %Q(mikel "." <mikel@lindsaar.net>),
1126
+ :name => %Q(mikel .),
1127
+ :display_name => %Q(mikel .),
1128
+ :address => %Q(mikel@lindsaar.net),
1129
+ :comments => nil,
1130
+ :domain => 'lindsaar.net',
1131
+ :local => %Q(mikel),
1132
+ :format => %Q(mikel "." <mikel@lindsaar.net>)
1133
+
1130
1134
  end
1131
-
1132
- def test_unquoted_at_char_in_name()
1135
+
1136
+ def test_at_char_in_address()
1133
1137
 
1134
1138
  validate_case__address\
1135
- %Q(mikel@me.com <lindsaar@you.net>),
1136
- :name => "mikel@me.com",
1137
- :display_name => "mikel@me.com",
1139
+ %Q(mikel@lindsaar.net <lindsaar@you.net>),
1140
+ :name => "mikel@lindsaar.net",
1141
+ :display_name => "mikel@lindsaar.net",
1138
1142
  :address => %Q(lindsaar@you.net),
1139
1143
  :comments => nil,
1140
1144
  :domain => 'you.net',
1141
1145
  :local => %Q(lindsaar),
1142
- :format => %Q("mikel@me.com" <lindsaar@you.net>)
1143
-
1144
- end
1145
-
1146
- def test_special_quote_quoting_at_char_in_string
1147
- string = 'mikel@me.com <mikel@me.com>'
1148
- result = '"mikel@me.com" <mikel@me.com>'
1149
- assert_equal(result, TMail::Address.special_quote_address(string))
1150
- end
1151
-
1152
- def test_special_quote_not_quoting_already_quoted_at_char_in_string
1153
- string = '"mikel@me.com" <mikel@me.com>'
1154
- result = '"mikel@me.com" <mikel@me.com>'
1155
- assert_equal(result, TMail::Address.special_quote_address(string))
1156
- end
1157
-
1158
- def test_special_quote_not_quoting_something_without_an_at_char_and_quoted
1159
- string = '"mikel" <mikel@me.com>'
1160
- result = '"mikel" <mikel@me.com>'
1161
- assert_equal(result, TMail::Address.special_quote_address(string))
1162
- end
1146
+ :format => %Q("mikel@lindsaar.net" <lindsaar@you.net>)
1163
1147
 
1164
- def test_special_quote_not_quoting_something_without_an_at_char_in_header
1165
- string = 'mikel <mikel@me.com>'
1166
- result = 'mikel <mikel@me.com>'
1167
- assert_equal(result, TMail::Address.special_quote_address(string))
1168
- end
1169
-
1170
- def test_special_quoting_a_trailing_dot
1171
- string = 'mikel. <mikel@me.com>'
1172
- result = '"mikel." <mikel@me.com>'
1173
- assert_equal(result, TMail::Address.special_quote_address(string))
1174
- end
1175
-
1176
- def test_special_quoting_a_trailing_dot_by_itself
1177
- string = 'mikel . <mikel@me.com>'
1178
- result = '"mikel ." <mikel@me.com>'
1179
- assert_equal(result, TMail::Address.special_quote_address(string))
1180
- end
1181
-
1182
- def test_special_quoting_a_trailing_dot_by_itself_already_quoted
1183
- string = '"mikel ." <mikel@me.com>'
1184
- result = '"mikel ." <mikel@me.com>'
1185
- assert_equal(result, TMail::Address.special_quote_address(string))
1148
+ validate_case__address\
1149
+ %Q(mikel@lindsaar.net <mikel@lindsaar.net>),
1150
+ :name => %Q(mikel@lindsaar.net),
1151
+ :display_name => %Q(mikel@lindsaar.net),
1152
+ :address => %Q(mikel@lindsaar.net),
1153
+ :comments => nil,
1154
+ :domain => 'lindsaar.net',
1155
+ :local => %Q(mikel),
1156
+ :format => %Q(mikel@lindsaar.net)
1157
+
1158
+ validate_case__address\
1159
+ %Q("mikel@lindsaar.net" <mikel@lindsaar.net>),
1160
+ :name => %Q(mikel@lindsaar.net),
1161
+ :display_name => %Q(mikel@lindsaar.net),
1162
+ :address => %Q(mikel@lindsaar.net),
1163
+ :comments => nil,
1164
+ :domain => 'lindsaar.net',
1165
+ :local => %Q(mikel),
1166
+ :format => %Q(mikel@lindsaar.net)
1167
+
1168
+ validate_case__address\
1169
+ %Q("@" <"@"@lindsaar.net>),
1170
+ :name => "@",
1171
+ :display_name => "@",
1172
+ :address => %Q("@"@lindsaar.net),
1173
+ :comments => nil,
1174
+ :domain => 'lindsaar.net',
1175
+ :local => %Q("@"),
1176
+ :format => %Q("@" <"@"@lindsaar.net>)
1177
+
1178
+ validate_case__address\
1179
+ %Q("@" <"me@me"@lindsaar.net>),
1180
+ :name => "@",
1181
+ :display_name => "@",
1182
+ :address => %Q("me@me"@lindsaar.net),
1183
+ :comments => nil,
1184
+ :domain => 'lindsaar.net',
1185
+ :local => %Q("me@me"),
1186
+ :format => %Q("@" <"me@me"@lindsaar.net>)
1187
+
1188
+ validate_case__address\
1189
+ %Q("mikel" <mikel@lindsaar.net>),
1190
+ :name => "mikel",
1191
+ :display_name => "mikel",
1192
+ :address => %Q(mikel@lindsaar.net),
1193
+ :comments => nil,
1194
+ :domain => 'lindsaar.net',
1195
+ :local => %Q(mikel),
1196
+ :format => %Q("mikel" <mikel@lindsaar.net>)
1197
+
1198
+ validate_case__address\
1199
+ %Q(mikel <mikel@lindsaar.net>),
1200
+ :name => "mikel",
1201
+ :display_name => "mikel",
1202
+ :address => %Q(mikel@lindsaar.net),
1203
+ :comments => nil,
1204
+ :domain => 'lindsaar.net',
1205
+ :local => %Q(mikel),
1206
+ :format => %Q(mikel <mikel@lindsaar.net>)
1186
1207
  end
1187
1208
 
1188
- def test_special_quoting_a_trailing_dot_by_itself_quoted
1189
- string = 'mikel "." <mikel@me.com>'
1190
- result = 'mikel "." <mikel@me.com>'
1191
- assert_equal(result, TMail::Address.special_quote_address(string))
1209
+ def test_trailing_dot_in_name
1210
+ fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email_trailing_dot")
1211
+ str = 'Sandy M. <noreply@rubyforge.org>'
1212
+ mail = TMail::Mail.parse(fixture)
1213
+ assert_equal '"Sandy M." <noreply@rubyforge.org>', mail['from'].to_s
1192
1214
  end
1193
1215
 
1194
1216
  end
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
1
3
  require 'test_helper'
2
4
  require 'tmail'
3
5
 
@@ -42,7 +44,88 @@ HERE
42
44
  fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email8")
43
45
  mail = TMail::Mail.parse(fixture)
44
46
  attachment = mail.attachments.last
45
- assert_equal "01 Quien Te Dij\212at. Pitbull.mp3", attachment.original_filename
47
+ assert_equal "01 Quien Te Dij\302\212at. Pitbull.mp3", attachment.original_filename unless RUBY_VERSION.match(/1.9/)
48
+ end
49
+
50
+ def test_attachment_with_quoted_filename
51
+ fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email_with_quoted_attachment_filename")
52
+ mail = TMail::Mail.parse(fixture)
53
+ attachment = mail.attachments.last
54
+ str = "Eelanalüüsi päring.jpg"
55
+ assert_equal str, attachment.original_filename
56
+ end
57
+
58
+ def test_assigning_attachment_crashing_due_to_missing_boundary
59
+ mail = TMail::Mail.new
60
+ mail.mime_version = '1.0'
61
+ mail.set_content_type("multipart", "mixed")
62
+
63
+ mailpart=TMail::Mail.new
64
+ mailpart.set_content_type("application", "octet-stream")
65
+ mailpart['Content-Disposition'] = "attachment; filename=mailbox.zip"
66
+
67
+ assert_nothing_raised { mail.parts.push(mailpart) }
68
+ end
69
+
70
+ def test_only_has_attachment
71
+ fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email_only_attachment")
72
+ mail = TMail::Mail.parse(fixture)
73
+ assert_equal(1, mail.attachments.length)
74
+ end
75
+
76
+ def test_content_nil_returned_if_name_of_attachment_type_unquoted
77
+ fixture = File.read(File.dirname(__FILE__) + "/fixtures/unquoted_filename_in_attachment")
78
+ mail = TMail::Mail.parse(fixture)
79
+ assert_equal("image/png", mail.attachments.first.content_type)
80
+ end
81
+
82
+ def test_unquoted_apple_mail_content_type
83
+ fixture = File.read(File.dirname(__FILE__) + "/fixtures/apple_unquoted_content_type")
84
+ mail = TMail::Mail.parse(fixture)
85
+ assert_equal("application/pdf", mail.attachments.first.content_type)
46
86
  end
47
87
 
88
+ # TMail::Mail.has_attachments? & TMail::Mail.attachments
89
+ # http://rubyforge.org/tracker/index.php?func=detail&aid=23099&group_id=4512&atid=17370
90
+ def test_the_only_part_is_a_word_document
91
+ mail = load_fixture('the_only_part_is_a_word_document.txt')
92
+
93
+ assert_equal('application/msword', mail.content_type)
94
+ assert !mail.multipart?, 'The mail should not be multipart'
95
+ assert mail.attachment?(mail), 'The mail should be considered has an attachment'
96
+
97
+ # The original method TMail::Mail.has_attachments? returns false
98
+ assert mail.has_attachments?, 'PATCH: TMail should consider that this email has an attachment'
99
+
100
+ # The original method TMail::Mail.attachments returns nil
101
+ assert_not_nil mail.attachments, 'PATCH: TMail should return the attachment'
102
+ assert_equal 1, mail.attachments.size, 'PATCH: TMail should detect one attachment'
103
+ assert_instance_of TMail::Attachment, mail.attachments.first, 'The first attachment found should be an instance of TMail::Attachment'
104
+ end
105
+
106
+ # new method TMail::Mail.inline_attachment?
107
+ def test_inline_attachment_should_detect_inline_attachments
108
+ mail = load_fixture('inline_attachment.txt')
109
+
110
+ assert !mail.inline_attachment?(mail.parts[0]), 'The first part is an empty text'
111
+ assert mail.inline_attachment?(mail.parts[1]), 'The second part is an inline attachment'
112
+
113
+ mail = load_fixture('the_only_part_is_a_word_document.txt')
114
+ assert !mail.inline_attachment?(mail), 'The first and only part is an normal attachment'
115
+ end
116
+
117
+ # new method TMail::Mail.text_content_type?
118
+ def test_text_content_type?
119
+ mail = load_fixture('inline_attachment.txt')
120
+
121
+ assert mail.parts[0].text_content_type?, 'The first part of inline_attachment.txt is a text'
122
+ assert !mail.parts[1].text_content_type?, 'The second part of inline_attachment.txt is not a text'
123
+ end
124
+
125
+ protected
126
+
127
+ def load_fixture(name)
128
+ TMail::Mail.load(File.join('test', 'fixtures', name))
129
+ end
130
+
48
131
  end