tmail 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/CHANGES +11 -0
  2. data/NOTES +48 -38
  3. data/README +3 -2
  4. data/Rakefile +11 -0
  5. data/ext/Makefile +8 -8
  6. data/ext/{mailscanner → tmailscanner}/tmail/MANIFEST +1 -1
  7. data/ext/tmailscanner/tmail/depend +1 -0
  8. data/ext/{mailscanner → tmailscanner}/tmail/extconf.rb +1 -1
  9. data/ext/{mailscanner/tmail/mailscanner.c → tmailscanner/tmail/tmailscanner.c} +10 -10
  10. data/lib/tmail/address.rb +9 -1
  11. data/lib/tmail/encode.rb +1 -0
  12. data/lib/tmail/header.rb +34 -2
  13. data/lib/tmail/mailbox.rb +3 -3
  14. data/lib/tmail/quoting.rb +0 -24
  15. data/lib/tmail/scanner.rb +4 -4
  16. data/lib/tmail/scanner_r.rb +1 -1
  17. data/lib/tmail/utils.rb +2 -3
  18. data/lib/tmail/version.rb +1 -1
  19. data/log/ChangeLog.txt +22 -0
  20. data/log/History.txt +1 -1
  21. data/meta/MANIFEST +18 -8
  22. data/{script → meta}/config.yaml +1 -1
  23. data/meta/tmail.roll +3 -0
  24. data/script/clobber/distclean +1 -1
  25. data/script/compile +2 -2
  26. data/script/pack/gem +93 -0
  27. data/script/pack/tgz +41 -0
  28. data/script/pack/zip +41 -0
  29. data/script/prepare +6 -1
  30. data/script/publish +2 -2
  31. data/script/rdoc +42 -0
  32. data/script/release +1 -3
  33. data/script/stamp +33 -0
  34. data/script/test +1 -1
  35. data/test/fixtures/mailbox +13 -0
  36. data/test/fixtures/mailbox_without_any_from_or_sender +10 -0
  37. data/test/fixtures/mailbox_without_from +11 -0
  38. data/test/fixtures/mailbox_without_return_path +12 -0
  39. data/test/fixtures/raw_email11 +2 -2
  40. data/test/fixtures/raw_email_with_bad_date +5 -5
  41. data/test/test_address.rb +32 -2
  42. data/test/test_attachments.rb +15 -0
  43. data/test/test_encode.rb +54 -52
  44. data/test/test_header.rb +57 -0
  45. data/test/test_helper.rb +1 -0
  46. data/test/test_mail.rb +49 -1
  47. data/test/test_mbox.rb +21 -0
  48. data/test/test_quote.rb +71 -0
  49. metadata +173 -153
  50. data/ext/mailscanner/tmail/depend +0 -1
  51. data/meta/ROLLRC +0 -3
@@ -0,0 +1,71 @@
1
+ $:.unshift File.dirname(__FILE__)
2
+ require 'test_helper'
3
+
4
+ class TestQuote < Test::Unit::TestCase
5
+ def test_unquote_quoted_printable
6
+ a ="=?ISO-8859-1?Q?[166417]_Bekr=E6ftelse_fra_Rejsefeber?="
7
+ b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
8
+ assert_equal "[166417] Bekr\303\246ftelse fra Rejsefeber", b
9
+ end
10
+
11
+ def test_unquote_base64
12
+ a ="=?ISO-8859-1?B?WzE2NjQxN10gQmVrcuZmdGVsc2UgZnJhIFJlanNlZmViZXI=?="
13
+ b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
14
+ assert_equal "[166417] Bekr\303\246ftelse fra Rejsefeber", b
15
+ end
16
+
17
+ def test_unquote_without_charset
18
+ a ="[166417]_Bekr=E6ftelse_fra_Rejsefeber"
19
+ b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
20
+ assert_equal "[166417]_Bekr=E6ftelse_fra_Rejsefeber", b
21
+ end
22
+
23
+ def test_unqoute_multiple
24
+ a ="=?utf-8?q?Re=3A_=5B12=5D_=23137=3A_Inkonsistente_verwendung_von_=22Hin?==?utf-8?b?enVmw7xnZW4i?="
25
+ b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
26
+ assert_equal "Re: [12] #137: Inkonsistente verwendung von \"Hinzuf\303\274gen\"", b
27
+ end
28
+
29
+ def test_unqoute_in_the_middle
30
+ a ="Re: Photos =?ISO-8859-1?Q?Brosch=FCre_Rand?="
31
+ b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
32
+ assert_equal "Re: Photos Brosch\303\274re Rand", b
33
+ end
34
+
35
+ def test_unqoute_iso
36
+ a ="=?ISO-8859-1?Q?Brosch=FCre_Rand?="
37
+ b = TMail::Unquoter.unquote_and_convert_to(a, 'iso-8859-1')
38
+ expected = "Brosch\374re Rand"
39
+ expected.force_encoding 'iso-8859-1' if expected.respond_to? :force_encoding
40
+ assert_equal expected, b
41
+ end
42
+
43
+ # test an email that has been created using \r\n newlines, instead of
44
+ # \n newlines.
45
+ def test_email_quoted_with_0d0a
46
+ mail = TMail::Mail.parse(IO.read("#{File.dirname(__FILE__)}/fixtures/raw_email_quoted_with_0d0a"))
47
+ assert_match %r{Elapsed time}, mail.body
48
+ end
49
+
50
+ def test_email_with_partially_quoted_subject
51
+ mail = TMail::Mail.parse(IO.read("#{File.dirname(__FILE__)}/fixtures/raw_email_with_partially_quoted_subject"))
52
+ assert_equal "Re: Test: \"\346\274\242\345\255\227\" mid \"\346\274\242\345\255\227\" tail", mail.subject
53
+ end
54
+
55
+ def test_decode
56
+ encoded, decoded = expected_base64_strings
57
+ assert_equal decoded, TMail::Base64.decode(encoded)
58
+ end
59
+
60
+ def test_encode
61
+ encoded, decoded = expected_base64_strings
62
+ assert_equal encoded.length, TMail::Base64.encode(decoded).length
63
+ end
64
+
65
+ private
66
+
67
+ def expected_base64_strings
68
+ [ File.read("#{File.dirname(__FILE__)}/fixtures/raw_base64_encoded_string"), File.read("#{File.dirname(__FILE__)}/fixtures/raw_base64_decoded_string") ]
69
+ end
70
+
71
+ end
metadata CHANGED
@@ -1,211 +1,231 @@
1
1
  --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.4.6
3
+ specification_version: 2
2
4
  name: tmail
3
5
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
5
- platform: ruby
6
- authors:
7
- -
6
+ version: 1.2.1
7
+ date: 2008-01-11 00:00:00 -05:00
8
+ summary: Ruby Mail Handler
9
+ require_paths:
10
+ - lib
11
+ - ext/tmail
12
+ email: tmail-talk@rubyforge.org
13
+ homepage:
14
+ rubyforge_project:
15
+ description: TMail is a Ruby-based mail handler. It allows you to compose stadards compliant emails in a very Ruby-way.
8
16
  autorequire:
17
+ default_executable:
9
18
  bindir: bin
19
+ has_rdoc:
20
+ required_ruby_version: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
25
+ version:
26
+ required_rubygems_version: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ version: "0"
31
+ version:
32
+ platform: ruby
33
+ signing_key:
10
34
  cert_chain: []
11
35
 
12
- date: 2007-12-02 00:00:00 +11:00
13
- default_executable:
14
- dependencies: []
15
-
16
- description: TMail is a Ruby-based mail handler. It allows you to compose stadards compliant emails in a very Ruby-way.
17
- email: tmail-talk@rubyforge.org
18
- executables: []
19
-
20
- extensions: []
21
-
22
- extra_rdoc_files: []
23
-
36
+ post_install_message:
37
+ extensions_fallback:
38
+ authors:
39
+ - -
24
40
  files:
25
- - CHANGES
41
+ - test
42
+ - test/fixtures
43
+ - test/fixtures/raw_email_quoted_with_0d0a
44
+ - test/fixtures/raw_email2
45
+ - test/fixtures/raw_email3
46
+ - test/fixtures/raw_email4
47
+ - test/fixtures/raw_email5
48
+ - test/fixtures/raw_email6
49
+ - test/fixtures/raw_email7
50
+ - test/fixtures/raw_email_with_illegal_boundary
51
+ - test/fixtures/raw_email8
52
+ - test/fixtures/raw_email9
53
+ - test/fixtures/raw_base64_decoded_string
54
+ - test/fixtures/raw_email
55
+ - test/fixtures/raw_email10
56
+ - test/fixtures/raw_email11
57
+ - test/fixtures/raw_email12
58
+ - test/fixtures/raw_email13
59
+ - test/fixtures/raw_base64_encoded_string
60
+ - test/fixtures/raw_email_with_nested_attachment
61
+ - test/fixtures/raw_email_with_multipart_mixed_quoted_boundary
62
+ - test/fixtures/raw_email_with_quoted_illegal_boundary
63
+ - test/fixtures/raw_email_with_partially_quoted_subject
64
+ - test/fixtures/raw_email_simple
65
+ - test/fixtures/raw_base64_email
66
+ - test/fixtures/raw_email_with_bad_date
67
+ - test/fixtures/raw_email_reply
68
+ - test/fixtures/mailbox_without_return_path
69
+ - test/fixtures/mailbox
70
+ - test/fixtures/mailbox_without_from
71
+ - test/fixtures/mailbox_without_any_from_or_sender
72
+ - test/test_helper.rb
73
+ - test/test_utils.rb
74
+ - test/test_mail.rb
75
+ - test/extctrl.rb
76
+ - test/kcode.rb
77
+ - test/test_base64.rb
78
+ - test/test_port.rb
79
+ - test/test_address.rb
80
+ - test/test_mbox.rb
81
+ - test/test_header.rb
82
+ - test/test_scanner.rb
83
+ - test/test_encode.rb
84
+ - test/test_attachments.rb
85
+ - test/test_quote.rb
86
+ - sample
87
+ - sample/data
88
+ - sample/data/test
89
+ - sample/data/multipart
90
+ - sample/data/normal
91
+ - sample/data/sendtest
92
+ - sample/data/simple
93
+ - sample/from-check.rb
94
+ - sample/multipart.rb
95
+ - sample/parse-bench.rb
96
+ - sample/parse-test.rb
97
+ - sample/extract-attachements.rb
98
+ - sample/sendmail.rb
99
+ - sample/bench_base64.rb
100
+ - README
26
101
  - ext
27
- - ext/mailscanner
28
- - ext/mailscanner/tmail
29
- - ext/mailscanner/tmail/depend
30
- - ext/mailscanner/tmail/extconf.rb
31
- - ext/mailscanner/tmail/mailscanner.c
32
- - ext/mailscanner/tmail/MANIFEST
33
102
  - ext/Makefile
103
+ - ext/tmailscanner
104
+ - ext/tmailscanner/tmail
105
+ - ext/tmailscanner/tmail/depend
106
+ - ext/tmailscanner/tmail/tmailscanner.c
107
+ - ext/tmailscanner/tmail/MANIFEST
108
+ - ext/tmailscanner/tmail/extconf.rb
109
+ - pkg
110
+ - Rakefile
34
111
  - lib
35
112
  - lib/tmail
36
- - lib/tmail/address.rb
37
- - lib/tmail/attachments.rb
38
- - lib/tmail/base64.rb
113
+ - lib/tmail/mail.rb
39
114
  - lib/tmail/compat.rb
40
- - lib/tmail/config.rb
41
- - lib/tmail/core_extensions.rb
42
- - lib/tmail/encode.rb
115
+ - lib/tmail/base64.rb
116
+ - lib/tmail/port.rb
117
+ - lib/tmail/address.rb
118
+ - lib/tmail/net.rb
43
119
  - lib/tmail/header.rb
44
- - lib/tmail/index.rb
45
- - lib/tmail/interface.rb
46
- - lib/tmail/loader.rb
47
- - lib/tmail/mail.rb
120
+ - lib/tmail/scanner.rb
48
121
  - lib/tmail/mailbox.rb
49
- - lib/tmail/main.rb
50
- - lib/tmail/Makefile
51
- - lib/tmail/mbox.rb
52
- - lib/tmail/net.rb
53
- - lib/tmail/obsolete.rb
122
+ - lib/tmail/index.rb
54
123
  - lib/tmail/parser.rb
124
+ - lib/tmail/encode.rb
125
+ - lib/tmail/stringio.rb
126
+ - lib/tmail/utils.rb
55
127
  - lib/tmail/parser.y
56
- - lib/tmail/port.rb
128
+ - lib/tmail/mbox.rb
129
+ - lib/tmail/config.rb
57
130
  - lib/tmail/quoting.rb
58
- - lib/tmail/require_arch.rb
59
- - lib/tmail/scanner.rb
131
+ - lib/tmail/loader.rb
60
132
  - lib/tmail/scanner_r.rb
61
- - lib/tmail/stringio.rb
62
- - lib/tmail/utils.rb
133
+ - lib/tmail/Makefile
134
+ - lib/tmail/obsolete.rb
135
+ - lib/tmail/interface.rb
136
+ - lib/tmail/core_extensions.rb
137
+ - lib/tmail/attachments.rb
63
138
  - lib/tmail/version.rb
139
+ - lib/tmail/main.rb
140
+ - lib/tmail/require_arch.rb
64
141
  - lib/tmail.rb
65
142
  - LICENSE
66
143
  - log
67
- - log/ChangeLog.txt
68
144
  - log/History.txt
145
+ - log/ChangeLog.txt
69
146
  - log/Todo.txt
70
147
  - meta
71
148
  - meta/icli.yaml
149
+ - meta/config.yaml
72
150
  - meta/MANIFEST
73
151
  - meta/project.yaml
74
- - meta/ROLLRC
75
- - NOTES
76
- - README
77
- - sample
78
- - sample/bench_base64.rb
79
- - sample/data
80
- - sample/data/multipart
81
- - sample/data/normal
82
- - sample/data/sendtest
83
- - sample/data/simple
84
- - sample/data/test
85
- - sample/extract-attachements.rb
86
- - sample/from-check.rb
87
- - sample/multipart.rb
88
- - sample/parse-bench.rb
89
- - sample/parse-test.rb
90
- - sample/sendmail.rb
152
+ - meta/tmail.roll
153
+ - doc
91
154
  - script
92
- - script/changelog
93
155
  - script/clobber
94
- - script/clobber/distclean
95
156
  - script/clobber/package
96
- - script/compile
97
- - script/config.yaml
98
- - script/prepare
157
+ - script/clobber/distclean
99
158
  - script/publish
100
- - script/release
159
+ - script/rdoc
101
160
  - script/setup
102
161
  - script/stats
162
+ - script/pack
163
+ - script/pack/gem
164
+ - script/pack/tgz
165
+ - script/pack/zip
166
+ - script/stamp
167
+ - script/prepare
168
+ - script/compile
103
169
  - script/tag
104
170
  - script/test
105
- - test
106
- - test/extctrl.rb
171
+ - script/release
172
+ - script/changelog
173
+ - CHANGES
174
+ - NOTES
175
+ test_files:
107
176
  - test/fixtures
108
- - test/fixtures/raw_base64_decoded_string
109
- - test/fixtures/raw_base64_email
110
- - test/fixtures/raw_base64_encoded_string
111
- - test/fixtures/raw_email
112
- - test/fixtures/raw_email10
113
- - test/fixtures/raw_email11
114
- - test/fixtures/raw_email12
115
- - test/fixtures/raw_email13
177
+ - test/fixtures/raw_email_quoted_with_0d0a
116
178
  - test/fixtures/raw_email2
117
179
  - test/fixtures/raw_email3
118
180
  - test/fixtures/raw_email4
119
181
  - test/fixtures/raw_email5
120
182
  - test/fixtures/raw_email6
121
183
  - test/fixtures/raw_email7
184
+ - test/fixtures/raw_email_with_illegal_boundary
122
185
  - test/fixtures/raw_email8
123
186
  - test/fixtures/raw_email9
124
- - test/fixtures/raw_email_quoted_with_0d0a
125
- - test/fixtures/raw_email_reply
126
- - test/fixtures/raw_email_simple
127
- - test/fixtures/raw_email_with_bad_date
128
- - test/fixtures/raw_email_with_illegal_boundary
129
- - test/fixtures/raw_email_with_multipart_mixed_quoted_boundary
130
- - test/fixtures/raw_email_with_nested_attachment
131
- - test/fixtures/raw_email_with_partially_quoted_subject
132
- - test/fixtures/raw_email_with_quoted_illegal_boundary
133
- - test/kcode.rb
134
- - test/test_address.rb
135
- - test/test_attachments.rb
136
- - test/test_base64.rb
137
- - test/test_encode.rb
138
- - test/test_header.rb
139
- - test/test_helper.rb
140
- - test/test_mail.rb
141
- - test/test_mbox.rb
142
- - test/test_port.rb
143
- - test/test_scanner.rb
144
- - test/test_utils.rb
145
- has_rdoc:
146
- homepage:
147
- post_install_message:
148
- rdoc_options: []
149
-
150
- require_paths:
151
- - lib
152
- - ext/tmail
153
- required_ruby_version: !ruby/object:Gem::Requirement
154
- requirements:
155
- - - ">="
156
- - !ruby/object:Gem::Version
157
- version: "0"
158
- version:
159
- required_rubygems_version: !ruby/object:Gem::Requirement
160
- requirements:
161
- - - ">="
162
- - !ruby/object:Gem::Version
163
- version: "0"
164
- version:
165
- requirements: []
166
-
167
- rubyforge_project:
168
- rubygems_version: 0.9.5
169
- signing_key:
170
- specification_version: 2
171
- summary: Ruby Mail Handler
172
- test_files:
173
- - test/extctrl.rb
174
- - test/fixtures
175
187
  - test/fixtures/raw_base64_decoded_string
176
- - test/fixtures/raw_base64_email
177
- - test/fixtures/raw_base64_encoded_string
178
188
  - test/fixtures/raw_email
179
189
  - test/fixtures/raw_email10
180
190
  - test/fixtures/raw_email11
181
191
  - test/fixtures/raw_email12
182
192
  - test/fixtures/raw_email13
183
- - test/fixtures/raw_email2
184
- - test/fixtures/raw_email3
185
- - test/fixtures/raw_email4
186
- - test/fixtures/raw_email5
187
- - test/fixtures/raw_email6
188
- - test/fixtures/raw_email7
189
- - test/fixtures/raw_email8
190
- - test/fixtures/raw_email9
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_multipart_mixed_quoted_boundary
193
+ - test/fixtures/raw_base64_encoded_string
197
194
  - test/fixtures/raw_email_with_nested_attachment
198
- - test/fixtures/raw_email_with_partially_quoted_subject
195
+ - test/fixtures/raw_email_with_multipart_mixed_quoted_boundary
199
196
  - test/fixtures/raw_email_with_quoted_illegal_boundary
200
- - test/kcode.rb
201
- - test/test_address.rb
202
- - test/test_attachments.rb
203
- - test/test_base64.rb
204
- - test/test_encode.rb
205
- - test/test_header.rb
197
+ - test/fixtures/raw_email_with_partially_quoted_subject
198
+ - test/fixtures/raw_email_simple
199
+ - test/fixtures/raw_base64_email
200
+ - test/fixtures/raw_email_with_bad_date
201
+ - test/fixtures/raw_email_reply
202
+ - test/fixtures/mailbox_without_return_path
203
+ - test/fixtures/mailbox
204
+ - test/fixtures/mailbox_without_from
205
+ - test/fixtures/mailbox_without_any_from_or_sender
206
206
  - test/test_helper.rb
207
+ - test/test_utils.rb
207
208
  - test/test_mail.rb
208
- - test/test_mbox.rb
209
+ - test/extctrl.rb
210
+ - test/kcode.rb
211
+ - test/test_base64.rb
209
212
  - test/test_port.rb
213
+ - test/test_address.rb
214
+ - test/test_mbox.rb
215
+ - test/test_header.rb
210
216
  - test/test_scanner.rb
211
- - test/test_utils.rb
217
+ - test/test_encode.rb
218
+ - test/test_attachments.rb
219
+ - test/test_quote.rb
220
+ rdoc_options: []
221
+
222
+ extra_rdoc_files: []
223
+
224
+ executables: []
225
+
226
+ extensions: []
227
+
228
+ requirements: []
229
+
230
+ dependencies: []
231
+