tmail_es 1.2.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES +83 -0
- data/LICENSE +21 -0
- data/NOTES +7 -0
- data/README +182 -0
- data/Rakefile +2 -0
- data/ext/Makefile +20 -0
- data/ext/tmailscanner/tmail/MANIFEST +4 -0
- data/ext/tmailscanner/tmail/depend +1 -0
- data/ext/tmailscanner/tmail/extconf.rb +33 -0
- data/ext/tmailscanner/tmail/tmailscanner.c +614 -0
- data/lib/tmail/Makefile +18 -0
- data/lib/tmail/address.rb +392 -0
- data/lib/tmail/attachments.rb +65 -0
- data/lib/tmail/base64.rb +46 -0
- data/lib/tmail/compat.rb +41 -0
- data/lib/tmail/config.rb +67 -0
- data/lib/tmail/core_extensions.rb +63 -0
- data/lib/tmail/encode.rb +590 -0
- data/lib/tmail/header.rb +962 -0
- data/lib/tmail/index.rb +9 -0
- data/lib/tmail/interface.rb +1162 -0
- data/lib/tmail/loader.rb +3 -0
- data/lib/tmail/mail.rb +578 -0
- data/lib/tmail/mailbox.rb +496 -0
- data/lib/tmail/main.rb +6 -0
- data/lib/tmail/mbox.rb +3 -0
- data/lib/tmail/net.rb +250 -0
- data/lib/tmail/obsolete.rb +132 -0
- data/lib/tmail/parser.rb +1060 -0
- data/lib/tmail/parser.y +416 -0
- data/lib/tmail/port.rb +379 -0
- data/lib/tmail/quoting.rb +164 -0
- data/lib/tmail/require_arch.rb +58 -0
- data/lib/tmail/scanner.rb +49 -0
- data/lib/tmail/scanner_r.rb +261 -0
- data/lib/tmail/stringio.rb +280 -0
- data/lib/tmail/utils.rb +361 -0
- data/lib/tmail/vendor/rchardet-1.3/COPYING +504 -0
- data/lib/tmail/vendor/rchardet-1.3/README +12 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/big5freq.rb +927 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/big5prober.rb +42 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/chardistribution.rb +238 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/charsetgroupprober.rb +112 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/charsetprober.rb +75 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/codingstatemachine.rb +64 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/constants.rb +42 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/escprober.rb +89 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/escsm.rb +244 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/eucjpprober.rb +88 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/euckrfreq.rb +596 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/euckrprober.rb +42 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/euctwfreq.rb +430 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/euctwprober.rb +42 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312freq.rb +474 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312prober.rb +42 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/hebrewprober.rb +289 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/jisfreq.rb +570 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/jpcntx.rb +229 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langbulgarianmodel.rb +229 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langcyrillicmodel.rb +330 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langgreekmodel.rb +227 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langhebrewmodel.rb +202 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langhungarianmodel.rb +226 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langthaimodel.rb +201 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/latin1prober.rb +147 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/mbcharsetprober.rb +89 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/mbcsgroupprober.rb +45 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/mbcssm.rb +542 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/sbcharsetprober.rb +124 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/sbcsgroupprober.rb +56 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/sjisprober.rb +88 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/universaldetector.rb +167 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/utf8prober.rb +87 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet.rb +67 -0
- data/lib/tmail/version.rb +40 -0
- data/lib/tmail.rb +6 -0
- data/setup.rb +1482 -0
- data/test/extctrl.rb +6 -0
- data/test/fixtures/apple_unquoted_content_type +44 -0
- data/test/fixtures/inline_attachment.txt +2095 -0
- data/test/fixtures/iso_8859_1_email_without_encoding_and_message_id.txt +16 -0
- data/test/fixtures/mailbox +414 -0
- data/test/fixtures/mailbox.zip +0 -0
- data/test/fixtures/mailbox_without_any_from_or_sender +10 -0
- data/test/fixtures/mailbox_without_from +11 -0
- data/test/fixtures/mailbox_without_return_path +12 -0
- data/test/fixtures/marked_as_iso_8859_1_but_it_is_utf_8.txt +33 -0
- data/test/fixtures/marked_as_utf_8_but_it_is_iso_8859_1.txt +56 -0
- data/test/fixtures/raw_attack_email_with_zero_length_whitespace +29 -0
- data/test/fixtures/raw_base64_decoded_string +0 -0
- data/test/fixtures/raw_base64_email +83 -0
- data/test/fixtures/raw_base64_encoded_string +1 -0
- data/test/fixtures/raw_email +14 -0
- data/test/fixtures/raw_email10 +20 -0
- data/test/fixtures/raw_email11 +34 -0
- data/test/fixtures/raw_email12 +32 -0
- data/test/fixtures/raw_email13 +29 -0
- data/test/fixtures/raw_email2 +114 -0
- data/test/fixtures/raw_email3 +70 -0
- data/test/fixtures/raw_email4 +59 -0
- data/test/fixtures/raw_email5 +19 -0
- data/test/fixtures/raw_email6 +20 -0
- data/test/fixtures/raw_email7 +66 -0
- data/test/fixtures/raw_email8 +47 -0
- data/test/fixtures/raw_email9 +28 -0
- data/test/fixtures/raw_email_bad_time +62 -0
- data/test/fixtures/raw_email_double_at_in_header +14 -0
- data/test/fixtures/raw_email_multiple_from +30 -0
- data/test/fixtures/raw_email_only_attachment +17 -0
- data/test/fixtures/raw_email_quoted_with_0d0a +14 -0
- data/test/fixtures/raw_email_reply +32 -0
- data/test/fixtures/raw_email_simple +11 -0
- data/test/fixtures/raw_email_string_in_date_field +17 -0
- data/test/fixtures/raw_email_trailing_dot +21 -0
- data/test/fixtures/raw_email_with_bad_date +48 -0
- data/test/fixtures/raw_email_with_illegal_boundary +58 -0
- data/test/fixtures/raw_email_with_mimepart_without_content_type +94 -0
- data/test/fixtures/raw_email_with_multipart_mixed_quoted_boundary +50 -0
- data/test/fixtures/raw_email_with_nested_attachment +100 -0
- data/test/fixtures/raw_email_with_partially_quoted_subject +14 -0
- data/test/fixtures/raw_email_with_quoted_attachment_filename +60 -0
- data/test/fixtures/raw_email_with_quoted_illegal_boundary +58 -0
- data/test/fixtures/raw_email_with_wrong_splitted_multibyte_encoded_word_subject +15 -0
- data/test/fixtures/the_only_part_is_a_word_document.txt +425 -0
- data/test/fixtures/unquoted_filename_in_attachment +177 -0
- data/test/kcode.rb +14 -0
- data/test/temp_test_one.rb +46 -0
- data/test/test_address.rb +1216 -0
- data/test/test_attachments.rb +133 -0
- data/test/test_base64.rb +64 -0
- data/test/test_encode.rb +139 -0
- data/test/test_header.rb +1021 -0
- data/test/test_helper.rb +9 -0
- data/test/test_mail.rb +756 -0
- data/test/test_mbox.rb +184 -0
- data/test/test_port.rb +440 -0
- data/test/test_quote.rb +107 -0
- data/test/test_scanner.rb +209 -0
- data/test/test_utils.rb +36 -0
- data/tmail_es.gemspec +35 -0
- metadata +257 -0
data/test/test_quote.rb
ADDED
@@ -0,0 +1,107 @@
|
|
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
|
+
expected = "[166417] Bekr\303\246ftelse fra Rejsefeber"
|
9
|
+
expected.force_encoding 'utf-8' if expected.respond_to? :force_encoding
|
10
|
+
assert_equal expected, b
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_unquote_base64
|
14
|
+
a ="=?ISO-8859-1?B?WzE2NjQxN10gQmVrcuZmdGVsc2UgZnJhIFJlanNlZmViZXI=?="
|
15
|
+
b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
|
16
|
+
expected = "[166417] Bekr\303\246ftelse fra Rejsefeber"
|
17
|
+
expected.force_encoding 'utf-8' if expected.respond_to? :force_encoding
|
18
|
+
assert_equal expected, b
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_unquote_without_charset
|
22
|
+
a ="[166417]_Bekr=E6ftelse_fra_Rejsefeber"
|
23
|
+
b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
|
24
|
+
expected = "[166417]_Bekr=E6ftelse_fra_Rejsefeber"
|
25
|
+
expected.force_encoding 'utf-8' if expected.respond_to? :force_encoding
|
26
|
+
assert_equal expected, b
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_unqoute_multiple
|
30
|
+
a ="=?utf-8?q?Re=3A_=5B12=5D_=23137=3A_Inkonsistente_verwendung_von_=22Hin?==?utf-8?b?enVmw7xnZW4i?="
|
31
|
+
b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
|
32
|
+
expected = "Re: [12] #137: Inkonsistente verwendung von \"Hinzuf\303\274gen\""
|
33
|
+
expected.force_encoding 'utf-8' if expected.respond_to? :force_encoding
|
34
|
+
assert_equal expected, b
|
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
|
45
|
+
|
46
|
+
def test_unqoute_in_the_middle
|
47
|
+
a ="Re: Photos =?ISO-8859-1?Q?Brosch=FCre_Rand?="
|
48
|
+
b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
|
49
|
+
expected = "Re: Photos Brosch\303\274re Rand"
|
50
|
+
expected.force_encoding 'utf-8' if expected.respond_to? :force_encoding
|
51
|
+
assert_equal expected, b
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_unqoute_iso
|
55
|
+
a ="=?ISO-8859-1?Q?Brosch=FCre_Rand?="
|
56
|
+
b = TMail::Unquoter.unquote_and_convert_to(a, 'iso-8859-1')
|
57
|
+
expected = "Brosch\374re Rand"
|
58
|
+
expected.force_encoding 'iso-8859-1' if expected.respond_to? :force_encoding
|
59
|
+
assert_equal expected, b
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_quote_multibyte_chars
|
63
|
+
original = "\303\246 \303\270 and \303\245"
|
64
|
+
unquoted = TMail::Unquoter.unquote_and_convert_to(original, nil)
|
65
|
+
original.force_encoding 'utf-8' if original.respond_to? :force_encoding
|
66
|
+
unquoted.force_encoding 'utf-8' if unquoted.respond_to? :force_encoding
|
67
|
+
assert_equal unquoted, original
|
68
|
+
end
|
69
|
+
|
70
|
+
# test an email that has been created using \r\n newlines, instead of
|
71
|
+
# \n newlines.
|
72
|
+
def test_email_quoted_with_0d0a
|
73
|
+
mail = TMail::Mail.parse(IO.read("#{File.dirname(__FILE__)}/fixtures/raw_email_quoted_with_0d0a"))
|
74
|
+
assert_match %r{Elapsed time}, mail.body
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_email_with_partially_quoted_subject
|
78
|
+
mail = TMail::Mail.parse(IO.read("#{File.dirname(__FILE__)}/fixtures/raw_email_with_partially_quoted_subject"))
|
79
|
+
expected = "Re: Test: \"\346\274\242\345\255\227\" mid \"\346\274\242\345\255\227\" tail"
|
80
|
+
expected.force_encoding 'utf-8' if expected.respond_to? :force_encoding
|
81
|
+
assert_equal expected, mail.subject
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_decode
|
85
|
+
encoded, decoded = expected_base64_strings
|
86
|
+
assert_equal decoded, TMail::Base64.decode(encoded)
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_encode
|
90
|
+
encoded, decoded = expected_base64_strings
|
91
|
+
assert_equal encoded, TMail::Base64.encode(decoded)
|
92
|
+
end
|
93
|
+
|
94
|
+
private
|
95
|
+
|
96
|
+
def expected_base64_strings
|
97
|
+
if RUBY_VERSION < '1.9'
|
98
|
+
options = "r"
|
99
|
+
else
|
100
|
+
options = "r:ASCII-8BIT"
|
101
|
+
end
|
102
|
+
encoded = File.open("#{File.dirname(__FILE__)}/fixtures/raw_base64_encoded_string", options) {|f| f.read }
|
103
|
+
decoded = File.open("#{File.dirname(__FILE__)}/fixtures/raw_base64_decoded_string", options) {|f| f.read }
|
104
|
+
[encoded, decoded]
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
@@ -0,0 +1,209 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__)
|
2
|
+
require 'test_helper'
|
3
|
+
require 'tmail/scanner'
|
4
|
+
require 'test/unit'
|
5
|
+
|
6
|
+
class ScannerTester < Test::Unit::TestCase
|
7
|
+
DEBUG = false
|
8
|
+
|
9
|
+
def do_test( scantype, str, ok, cmtok )
|
10
|
+
scanner = TMail::Scanner.new( str, scantype, comments = [] )
|
11
|
+
scanner.debug = DEBUG
|
12
|
+
|
13
|
+
idx = 0
|
14
|
+
scanner.scan do |sym, val|
|
15
|
+
if sym then
|
16
|
+
assert_equal ok.shift, [sym, val], "index=#{idx}"
|
17
|
+
else
|
18
|
+
assert_equal [false, '$'], [sym, val], "$end (index=#{idx})"
|
19
|
+
end
|
20
|
+
idx += 1
|
21
|
+
end
|
22
|
+
assert_equal [], ok
|
23
|
+
|
24
|
+
comments.each_with_index do |val, i|
|
25
|
+
assert_equal cmtok.shift, val, "index=#{i}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_atommode
|
30
|
+
do_test :ADDRESS,
|
31
|
+
'Capital CAPITAL word from id by with a0000',
|
32
|
+
[
|
33
|
+
[:ATOM, 'Capital'],
|
34
|
+
[:ATOM, 'CAPITAL'],
|
35
|
+
[:ATOM, 'word'],
|
36
|
+
[:ATOM, 'from'],
|
37
|
+
[:ATOM, 'id'],
|
38
|
+
[:ATOM, 'by'],
|
39
|
+
[:ATOM, 'with'],
|
40
|
+
[:ATOM, 'a0000']
|
41
|
+
],
|
42
|
+
[]
|
43
|
+
|
44
|
+
do_test :ADDRESS,
|
45
|
+
'(comment) (nested (comment) (again)) (a(b(c(d(e)))))',
|
46
|
+
[
|
47
|
+
],
|
48
|
+
[
|
49
|
+
'comment',
|
50
|
+
'nested (comment) (again)',
|
51
|
+
'a(b(c(d(e))))'
|
52
|
+
]
|
53
|
+
|
54
|
+
do_test :ADDRESS,
|
55
|
+
'=?iso-2022-jp?B?axaxax?=',
|
56
|
+
[
|
57
|
+
[:ATOM, '=?iso-2022-jp?B?axaxax?=']
|
58
|
+
],
|
59
|
+
[]
|
60
|
+
|
61
|
+
word = 'abcdefghijklmnopqrstuvwxyz' +
|
62
|
+
'ABCDEFGHIJKLMNOPQRSTUVWXYZ' +
|
63
|
+
'0123456789' +
|
64
|
+
%q[_#!$%&`'*+-{|}~^/=?]
|
65
|
+
do_test :ADDRESS, word,
|
66
|
+
[
|
67
|
+
[:ATOM, word]
|
68
|
+
],
|
69
|
+
[]
|
70
|
+
|
71
|
+
do_test :ADDRESS,
|
72
|
+
" \t\t\r\n \n\r\n \r \n atom",
|
73
|
+
[
|
74
|
+
[:ATOM, 'atom']
|
75
|
+
],
|
76
|
+
[]
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_tokenmode
|
80
|
+
do_test :CTYPE,
|
81
|
+
'text/html; charset=iso-2022-jp',
|
82
|
+
[
|
83
|
+
[:TOKEN, 'text'],
|
84
|
+
['/' , '/'],
|
85
|
+
[:TOKEN, 'html'],
|
86
|
+
[';' , ';'],
|
87
|
+
[:TOKEN, 'charset'],
|
88
|
+
['=' , '='],
|
89
|
+
[:TOKEN, 'iso-2022-jp']
|
90
|
+
],
|
91
|
+
[]
|
92
|
+
|
93
|
+
do_test :CTYPE,
|
94
|
+
'Text/Plain; Charset=ISO-2022-JP',
|
95
|
+
[
|
96
|
+
[:TOKEN, 'Text'],
|
97
|
+
['/' , '/'],
|
98
|
+
[:TOKEN, 'Plain'],
|
99
|
+
[';' , ';'],
|
100
|
+
[:TOKEN, 'Charset'],
|
101
|
+
['=' , '='],
|
102
|
+
[:TOKEN, 'ISO-2022-JP'],
|
103
|
+
],
|
104
|
+
[]
|
105
|
+
|
106
|
+
do_test :CTYPE,
|
107
|
+
'm_m/s_s; k_k=v_v',
|
108
|
+
[
|
109
|
+
[:TOKEN, 'm_m'],
|
110
|
+
['/' , '/'],
|
111
|
+
[:TOKEN, 's_s'],
|
112
|
+
[';' , ';'],
|
113
|
+
[:TOKEN, 'k_k'],
|
114
|
+
['=' , '='],
|
115
|
+
[:TOKEN, 'v_v'],
|
116
|
+
],
|
117
|
+
[]
|
118
|
+
|
119
|
+
word = 'abcdefghijklmnopqrstuvwxyz' +
|
120
|
+
'ABCDEFGHIJKLMNOPQRSTUVWXYZ' +
|
121
|
+
'0123456789' +
|
122
|
+
%q[_#!$%&`'*+-{|}~^.]
|
123
|
+
do_test :CTYPE, word,
|
124
|
+
[
|
125
|
+
[:TOKEN, word]
|
126
|
+
],
|
127
|
+
[]
|
128
|
+
end
|
129
|
+
|
130
|
+
def test_received
|
131
|
+
do_test :RECEIVED,
|
132
|
+
'from From by By via Via with With id Id for For',
|
133
|
+
[
|
134
|
+
[:FROM, 'from'],
|
135
|
+
[:FROM, 'From'],
|
136
|
+
[:BY, 'by'],
|
137
|
+
[:BY, 'By'],
|
138
|
+
[:VIA, 'via'],
|
139
|
+
[:VIA, 'Via'],
|
140
|
+
[:WITH, 'with'],
|
141
|
+
[:WITH, 'With'],
|
142
|
+
[:ID, 'id'],
|
143
|
+
[:ID, 'Id'],
|
144
|
+
[:FOR, 'for'],
|
145
|
+
[:FOR, 'For']
|
146
|
+
],
|
147
|
+
[]
|
148
|
+
|
149
|
+
str = <<EOS
|
150
|
+
from hoyogw.netlab.co.jp (daemon@hoyogw.netlab.co.jp [202.218.249.220])
|
151
|
+
by serv1.u-netsurf.ne.jp (8.8.8/3.6W-2.66(99/03/09))
|
152
|
+
with ESMTP id RAA10692 for <aamine@dp.u-netsurf.ne.jp>;
|
153
|
+
Thu, 18 Mar 1999 17:35:23 +0900 (JST)
|
154
|
+
EOS
|
155
|
+
ok = [
|
156
|
+
[ :FROM , 'from' ],
|
157
|
+
[ :ATOM , 'hoyogw' ],
|
158
|
+
[ '.' , '.' ],
|
159
|
+
[ :ATOM , 'netlab' ],
|
160
|
+
[ '.' , '.' ],
|
161
|
+
[ :ATOM , 'co' ],
|
162
|
+
[ '.' , '.' ],
|
163
|
+
[ :ATOM , 'jp' ],
|
164
|
+
[ :BY , 'by' ],
|
165
|
+
[ :ATOM , 'serv1' ],
|
166
|
+
[ '.' , '.' ],
|
167
|
+
[ :ATOM , 'u-netsurf' ],
|
168
|
+
[ '.' , '.' ],
|
169
|
+
[ :ATOM , 'ne' ],
|
170
|
+
[ '.' , '.' ],
|
171
|
+
[ :ATOM , 'jp' ],
|
172
|
+
[ :WITH , 'with' ],
|
173
|
+
[ :ATOM , 'ESMTP' ],
|
174
|
+
[ :ID , 'id' ],
|
175
|
+
[ :ATOM , 'RAA10692' ],
|
176
|
+
[ :FOR , 'for' ],
|
177
|
+
[ '<' , '<' ],
|
178
|
+
[ :ATOM , 'aamine' ],
|
179
|
+
[ '@' , '@' ],
|
180
|
+
[ :ATOM , 'dp' ],
|
181
|
+
[ '.' , '.' ],
|
182
|
+
[ :ATOM , 'u-netsurf' ],
|
183
|
+
[ '.' , '.' ],
|
184
|
+
[ :ATOM , 'ne' ],
|
185
|
+
[ '.' , '.' ],
|
186
|
+
[ :ATOM , 'jp' ],
|
187
|
+
[ '>' , '>' ],
|
188
|
+
[ ';' , ';' ],
|
189
|
+
[ :ATOM , 'Thu' ],
|
190
|
+
[ ',' , ',' ],
|
191
|
+
[ :DIGIT, '18' ],
|
192
|
+
[ :ATOM , 'Mar' ],
|
193
|
+
[ :DIGIT, '1999' ],
|
194
|
+
[ :DIGIT, '17' ],
|
195
|
+
[ ':' , ':' ],
|
196
|
+
[ :DIGIT, '35' ],
|
197
|
+
[ ':' , ':' ],
|
198
|
+
[ :DIGIT, '23' ],
|
199
|
+
[ :ATOM , '+0900' ]
|
200
|
+
]
|
201
|
+
cmtok = [
|
202
|
+
'daemon@hoyogw.netlab.co.jp [202.218.249.220]',
|
203
|
+
'8.8.8/3.6W-2.66(99/03/09)',
|
204
|
+
'JST'
|
205
|
+
]
|
206
|
+
|
207
|
+
do_test :RECEIVED, str, ok, cmtok
|
208
|
+
end
|
209
|
+
end
|
data/test/test_utils.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'tmail'
|
3
|
+
require 'tmail/utils'
|
4
|
+
|
5
|
+
class TestUtils < Test::Unit::TestCase
|
6
|
+
|
7
|
+
include TMail::TextUtils
|
8
|
+
|
9
|
+
def _test_new_boundary
|
10
|
+
a = new_boundary()
|
11
|
+
b = new_boundary()
|
12
|
+
c = new_boundary()
|
13
|
+
assert_instance_of String, a
|
14
|
+
assert_instance_of String, b
|
15
|
+
assert_instance_of String, c
|
16
|
+
assert(a != b)
|
17
|
+
assert(b != c)
|
18
|
+
assert(c != a)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_unquote
|
22
|
+
mail = TMail::Mail.new
|
23
|
+
assert_equal('Hello', mail.unquote('"Hello"'))
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_unquote_without_quotes
|
27
|
+
mail = TMail::Mail.new
|
28
|
+
assert_equal('Hello', mail.unquote('Hello'))
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_unquote_with_nil
|
32
|
+
mail = TMail::Mail.new
|
33
|
+
assert_equal(nil, mail.unquote(nil))
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
data/tmail_es.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "tmail_es"
|
5
|
+
s.version = "1.2.7.2"
|
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 standards compliant emails in a very Ruby-way. EuroServizi patch.}
|
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_es.gemspec) +
|
15
|
+
Dir.glob("lib/**/*") + Dir.glob("ext/**/*")
|
16
|
+
s.has_rdoc = true
|
17
|
+
s.homepage = "https://github.com/EuroServizi/tmail_es"
|
18
|
+
#s.homepage = %q{http://tmail.rubyforge.org}
|
19
|
+
s.rdoc_options = ["--inline-source", "--title", "TMail", "--main", "README"]
|
20
|
+
s.require_paths = ["lib", "ext/tmailscanner"]
|
21
|
+
s.rubyforge_project = %q{tmail}
|
22
|
+
s.rubygems_version = %q{1.3.1}
|
23
|
+
s.summary = %q{Ruby Mail Handler}
|
24
|
+
s.test_files = Dir.glob("test/**/*")
|
25
|
+
|
26
|
+
if s.respond_to? :specification_version then
|
27
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
28
|
+
s.specification_version = 2
|
29
|
+
|
30
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
31
|
+
else
|
32
|
+
end
|
33
|
+
else
|
34
|
+
end
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,257 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tmail_es
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.7.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mikel Lindsaar <raasdnil AT gmail.com>
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2010-01-06 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: TMail is a Ruby-based mail handler. It allows you to compose standards
|
14
|
+
compliant emails in a very Ruby-way. EuroServizi patch.
|
15
|
+
email: raasdnil AT gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions:
|
18
|
+
- ext/tmailscanner/tmail/extconf.rb
|
19
|
+
extra_rdoc_files:
|
20
|
+
- README
|
21
|
+
- CHANGES
|
22
|
+
- LICENSE
|
23
|
+
- NOTES
|
24
|
+
- Rakefile
|
25
|
+
files:
|
26
|
+
- CHANGES
|
27
|
+
- LICENSE
|
28
|
+
- NOTES
|
29
|
+
- README
|
30
|
+
- Rakefile
|
31
|
+
- ext/Makefile
|
32
|
+
- ext/tmailscanner/tmail/MANIFEST
|
33
|
+
- ext/tmailscanner/tmail/depend
|
34
|
+
- ext/tmailscanner/tmail/extconf.rb
|
35
|
+
- ext/tmailscanner/tmail/tmailscanner.c
|
36
|
+
- lib/tmail.rb
|
37
|
+
- lib/tmail/Makefile
|
38
|
+
- lib/tmail/address.rb
|
39
|
+
- lib/tmail/attachments.rb
|
40
|
+
- lib/tmail/base64.rb
|
41
|
+
- lib/tmail/compat.rb
|
42
|
+
- lib/tmail/config.rb
|
43
|
+
- lib/tmail/core_extensions.rb
|
44
|
+
- lib/tmail/encode.rb
|
45
|
+
- lib/tmail/header.rb
|
46
|
+
- lib/tmail/index.rb
|
47
|
+
- lib/tmail/interface.rb
|
48
|
+
- lib/tmail/loader.rb
|
49
|
+
- lib/tmail/mail.rb
|
50
|
+
- lib/tmail/mailbox.rb
|
51
|
+
- lib/tmail/main.rb
|
52
|
+
- lib/tmail/mbox.rb
|
53
|
+
- lib/tmail/net.rb
|
54
|
+
- lib/tmail/obsolete.rb
|
55
|
+
- lib/tmail/parser.rb
|
56
|
+
- lib/tmail/parser.y
|
57
|
+
- lib/tmail/port.rb
|
58
|
+
- lib/tmail/quoting.rb
|
59
|
+
- lib/tmail/require_arch.rb
|
60
|
+
- lib/tmail/scanner.rb
|
61
|
+
- lib/tmail/scanner_r.rb
|
62
|
+
- lib/tmail/stringio.rb
|
63
|
+
- lib/tmail/utils.rb
|
64
|
+
- lib/tmail/vendor/rchardet-1.3/COPYING
|
65
|
+
- lib/tmail/vendor/rchardet-1.3/README
|
66
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet.rb
|
67
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/big5freq.rb
|
68
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/big5prober.rb
|
69
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/chardistribution.rb
|
70
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/charsetgroupprober.rb
|
71
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/charsetprober.rb
|
72
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/codingstatemachine.rb
|
73
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/constants.rb
|
74
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/escprober.rb
|
75
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/escsm.rb
|
76
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/eucjpprober.rb
|
77
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/euckrfreq.rb
|
78
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/euckrprober.rb
|
79
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/euctwfreq.rb
|
80
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/euctwprober.rb
|
81
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312freq.rb
|
82
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312prober.rb
|
83
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/hebrewprober.rb
|
84
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/jisfreq.rb
|
85
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/jpcntx.rb
|
86
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/langbulgarianmodel.rb
|
87
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/langcyrillicmodel.rb
|
88
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/langgreekmodel.rb
|
89
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/langhebrewmodel.rb
|
90
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/langhungarianmodel.rb
|
91
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/langthaimodel.rb
|
92
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/latin1prober.rb
|
93
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/mbcharsetprober.rb
|
94
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/mbcsgroupprober.rb
|
95
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/mbcssm.rb
|
96
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/sbcharsetprober.rb
|
97
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/sbcsgroupprober.rb
|
98
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/sjisprober.rb
|
99
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/universaldetector.rb
|
100
|
+
- lib/tmail/vendor/rchardet-1.3/lib/rchardet/utf8prober.rb
|
101
|
+
- lib/tmail/version.rb
|
102
|
+
- setup.rb
|
103
|
+
- test/extctrl.rb
|
104
|
+
- test/fixtures/apple_unquoted_content_type
|
105
|
+
- test/fixtures/inline_attachment.txt
|
106
|
+
- test/fixtures/iso_8859_1_email_without_encoding_and_message_id.txt
|
107
|
+
- test/fixtures/mailbox
|
108
|
+
- test/fixtures/mailbox.zip
|
109
|
+
- test/fixtures/mailbox_without_any_from_or_sender
|
110
|
+
- test/fixtures/mailbox_without_from
|
111
|
+
- test/fixtures/mailbox_without_return_path
|
112
|
+
- test/fixtures/marked_as_iso_8859_1_but_it_is_utf_8.txt
|
113
|
+
- test/fixtures/marked_as_utf_8_but_it_is_iso_8859_1.txt
|
114
|
+
- test/fixtures/raw_attack_email_with_zero_length_whitespace
|
115
|
+
- test/fixtures/raw_base64_decoded_string
|
116
|
+
- test/fixtures/raw_base64_email
|
117
|
+
- test/fixtures/raw_base64_encoded_string
|
118
|
+
- test/fixtures/raw_email
|
119
|
+
- test/fixtures/raw_email10
|
120
|
+
- test/fixtures/raw_email11
|
121
|
+
- test/fixtures/raw_email12
|
122
|
+
- test/fixtures/raw_email13
|
123
|
+
- test/fixtures/raw_email2
|
124
|
+
- test/fixtures/raw_email3
|
125
|
+
- test/fixtures/raw_email4
|
126
|
+
- test/fixtures/raw_email5
|
127
|
+
- test/fixtures/raw_email6
|
128
|
+
- test/fixtures/raw_email7
|
129
|
+
- test/fixtures/raw_email8
|
130
|
+
- test/fixtures/raw_email9
|
131
|
+
- test/fixtures/raw_email_bad_time
|
132
|
+
- test/fixtures/raw_email_double_at_in_header
|
133
|
+
- test/fixtures/raw_email_multiple_from
|
134
|
+
- test/fixtures/raw_email_only_attachment
|
135
|
+
- test/fixtures/raw_email_quoted_with_0d0a
|
136
|
+
- test/fixtures/raw_email_reply
|
137
|
+
- test/fixtures/raw_email_simple
|
138
|
+
- test/fixtures/raw_email_string_in_date_field
|
139
|
+
- test/fixtures/raw_email_trailing_dot
|
140
|
+
- test/fixtures/raw_email_with_bad_date
|
141
|
+
- test/fixtures/raw_email_with_illegal_boundary
|
142
|
+
- test/fixtures/raw_email_with_mimepart_without_content_type
|
143
|
+
- test/fixtures/raw_email_with_multipart_mixed_quoted_boundary
|
144
|
+
- test/fixtures/raw_email_with_nested_attachment
|
145
|
+
- test/fixtures/raw_email_with_partially_quoted_subject
|
146
|
+
- test/fixtures/raw_email_with_quoted_attachment_filename
|
147
|
+
- test/fixtures/raw_email_with_quoted_illegal_boundary
|
148
|
+
- test/fixtures/raw_email_with_wrong_splitted_multibyte_encoded_word_subject
|
149
|
+
- test/fixtures/the_only_part_is_a_word_document.txt
|
150
|
+
- test/fixtures/unquoted_filename_in_attachment
|
151
|
+
- test/kcode.rb
|
152
|
+
- test/temp_test_one.rb
|
153
|
+
- test/test_address.rb
|
154
|
+
- test/test_attachments.rb
|
155
|
+
- test/test_base64.rb
|
156
|
+
- test/test_encode.rb
|
157
|
+
- test/test_header.rb
|
158
|
+
- test/test_helper.rb
|
159
|
+
- test/test_mail.rb
|
160
|
+
- test/test_mbox.rb
|
161
|
+
- test/test_port.rb
|
162
|
+
- test/test_quote.rb
|
163
|
+
- test/test_scanner.rb
|
164
|
+
- test/test_utils.rb
|
165
|
+
- tmail_es.gemspec
|
166
|
+
homepage: https://github.com/EuroServizi/tmail_es
|
167
|
+
licenses: []
|
168
|
+
metadata: {}
|
169
|
+
post_install_message:
|
170
|
+
rdoc_options:
|
171
|
+
- "--inline-source"
|
172
|
+
- "--title"
|
173
|
+
- TMail
|
174
|
+
- "--main"
|
175
|
+
- README
|
176
|
+
require_paths:
|
177
|
+
- lib
|
178
|
+
- ext/tmailscanner
|
179
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - ">="
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '0'
|
184
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - ">="
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: '0'
|
189
|
+
requirements: []
|
190
|
+
rubyforge_project: tmail
|
191
|
+
rubygems_version: 2.4.8
|
192
|
+
signing_key:
|
193
|
+
specification_version: 2
|
194
|
+
summary: Ruby Mail Handler
|
195
|
+
test_files:
|
196
|
+
- test/test_base64.rb
|
197
|
+
- test/test_address.rb
|
198
|
+
- test/test_encode.rb
|
199
|
+
- test/test_port.rb
|
200
|
+
- test/test_utils.rb
|
201
|
+
- test/test_scanner.rb
|
202
|
+
- test/extctrl.rb
|
203
|
+
- test/kcode.rb
|
204
|
+
- test/test_attachments.rb
|
205
|
+
- test/test_header.rb
|
206
|
+
- test/test_helper.rb
|
207
|
+
- test/temp_test_one.rb
|
208
|
+
- test/test_mbox.rb
|
209
|
+
- test/test_quote.rb
|
210
|
+
- test/fixtures/raw_email_with_bad_date
|
211
|
+
- test/fixtures/raw_email2
|
212
|
+
- test/fixtures/raw_email_with_quoted_illegal_boundary
|
213
|
+
- test/fixtures/raw_attack_email_with_zero_length_whitespace
|
214
|
+
- test/fixtures/raw_email_multiple_from
|
215
|
+
- test/fixtures/raw_email_with_nested_attachment
|
216
|
+
- test/fixtures/raw_email_reply
|
217
|
+
- test/fixtures/the_only_part_is_a_word_document.txt
|
218
|
+
- test/fixtures/raw_email9
|
219
|
+
- test/fixtures/raw_email8
|
220
|
+
- test/fixtures/raw_email6
|
221
|
+
- test/fixtures/mailbox.zip
|
222
|
+
- test/fixtures/mailbox_without_from
|
223
|
+
- test/fixtures/raw_email4
|
224
|
+
- test/fixtures/inline_attachment.txt
|
225
|
+
- test/fixtures/raw_email_trailing_dot
|
226
|
+
- test/fixtures/raw_email12
|
227
|
+
- test/fixtures/iso_8859_1_email_without_encoding_and_message_id.txt
|
228
|
+
- test/fixtures/unquoted_filename_in_attachment
|
229
|
+
- test/fixtures/mailbox_without_any_from_or_sender
|
230
|
+
- test/fixtures/raw_email13
|
231
|
+
- test/fixtures/raw_email10
|
232
|
+
- test/fixtures/marked_as_iso_8859_1_but_it_is_utf_8.txt
|
233
|
+
- test/fixtures/mailbox
|
234
|
+
- test/fixtures/raw_email_simple
|
235
|
+
- test/fixtures/raw_email7
|
236
|
+
- test/fixtures/raw_base64_encoded_string
|
237
|
+
- test/fixtures/mailbox_without_return_path
|
238
|
+
- test/fixtures/raw_email_with_mimepart_without_content_type
|
239
|
+
- test/fixtures/raw_email_with_multipart_mixed_quoted_boundary
|
240
|
+
- test/fixtures/raw_email5
|
241
|
+
- test/fixtures/raw_email_with_illegal_boundary
|
242
|
+
- test/fixtures/raw_email_bad_time
|
243
|
+
- test/fixtures/raw_email_with_wrong_splitted_multibyte_encoded_word_subject
|
244
|
+
- test/fixtures/raw_base64_email
|
245
|
+
- test/fixtures/raw_email_only_attachment
|
246
|
+
- test/fixtures/raw_email
|
247
|
+
- test/fixtures/marked_as_utf_8_but_it_is_iso_8859_1.txt
|
248
|
+
- test/fixtures/apple_unquoted_content_type
|
249
|
+
- test/fixtures/raw_email_with_quoted_attachment_filename
|
250
|
+
- test/fixtures/raw_email_with_partially_quoted_subject
|
251
|
+
- test/fixtures/raw_email_double_at_in_header
|
252
|
+
- test/fixtures/raw_email_string_in_date_field
|
253
|
+
- test/fixtures/raw_email_quoted_with_0d0a
|
254
|
+
- test/fixtures/raw_base64_decoded_string
|
255
|
+
- test/fixtures/raw_email11
|
256
|
+
- test/fixtures/raw_email3
|
257
|
+
- test/test_mail.rb
|