actionmailer 2.3.18 → 3.0.0.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +13 -16
- data/README +39 -21
- data/lib/action_mailer/adv_attr_accessor.rb +14 -18
- data/lib/action_mailer/base.rb +437 -560
- data/lib/action_mailer/collector.rb +36 -0
- data/lib/action_mailer/delivery_methods.rb +86 -0
- data/lib/action_mailer/deprecated_api.rb +139 -0
- data/lib/action_mailer/mail_helper.rb +25 -13
- data/lib/action_mailer/old_api.rb +248 -0
- data/lib/action_mailer/quoting.rb +4 -2
- data/lib/action_mailer/railtie.rb +25 -0
- data/lib/action_mailer/railties/subscriber.rb +20 -0
- data/lib/action_mailer/test_case.rb +4 -6
- data/lib/action_mailer/test_helper.rb +0 -1
- data/lib/action_mailer/tmail_compat.rb +34 -0
- data/lib/action_mailer/version.rb +3 -3
- data/lib/action_mailer.rb +25 -30
- metadata +41 -161
- data/Rakefile +0 -97
- data/install.rb +0 -30
- data/lib/action_mailer/helpers.rb +0 -113
- data/lib/action_mailer/part.rb +0 -107
- data/lib/action_mailer/part_container.rb +0 -55
- data/lib/action_mailer/utils.rb +0 -7
- data/lib/action_mailer/vendor/text-format-0.6.3/text/format.rb +0 -1466
- data/lib/action_mailer/vendor/text_format.rb +0 -10
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/Makefile +0 -18
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/address.rb +0 -392
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/attachments.rb +0 -65
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/base64.rb +0 -46
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/compat.rb +0 -41
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/config.rb +0 -67
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/core_extensions.rb +0 -63
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/encode.rb +0 -590
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/header.rb +0 -962
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/index.rb +0 -9
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/interface.rb +0 -1162
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/loader.rb +0 -3
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/mail.rb +0 -578
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/mailbox.rb +0 -496
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/main.rb +0 -6
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/mbox.rb +0 -3
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/net.rb +0 -250
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/obsolete.rb +0 -132
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/parser.rb +0 -1060
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/parser.y +0 -416
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/port.rb +0 -379
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/quoting.rb +0 -164
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/require_arch.rb +0 -58
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/scanner.rb +0 -49
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/scanner_r.rb +0 -262
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/stringio.rb +0 -280
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/utils.rb +0 -362
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/COPYING +0 -504
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/README +0 -12
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/big5freq.rb +0 -927
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/big5prober.rb +0 -42
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/chardistribution.rb +0 -238
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/charsetgroupprober.rb +0 -112
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/charsetprober.rb +0 -75
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/codingstatemachine.rb +0 -64
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/constants.rb +0 -42
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/escprober.rb +0 -89
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/escsm.rb +0 -244
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/eucjpprober.rb +0 -88
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euckrfreq.rb +0 -596
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euckrprober.rb +0 -42
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euctwfreq.rb +0 -430
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euctwprober.rb +0 -42
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312freq.rb +0 -474
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312prober.rb +0 -42
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/hebrewprober.rb +0 -289
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/jisfreq.rb +0 -570
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/jpcntx.rb +0 -229
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langbulgarianmodel.rb +0 -229
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langcyrillicmodel.rb +0 -330
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langgreekmodel.rb +0 -227
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langhebrewmodel.rb +0 -202
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langhungarianmodel.rb +0 -226
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langthaimodel.rb +0 -201
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/latin1prober.rb +0 -147
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/mbcharsetprober.rb +0 -89
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/mbcsgroupprober.rb +0 -45
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/mbcssm.rb +0 -542
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sbcharsetprober.rb +0 -124
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sbcsgroupprober.rb +0 -56
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sjisprober.rb +0 -88
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/universaldetector.rb +0 -168
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/utf8prober.rb +0 -87
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet.rb +0 -67
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/version.rb +0 -39
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail.rb +0 -6
- data/lib/action_mailer/vendor/tmail.rb +0 -17
- data/lib/actionmailer.rb +0 -2
- data/test/abstract_unit.rb +0 -62
- data/test/asset_host_test.rb +0 -54
- data/test/delivery_method_test.rb +0 -51
- data/test/fixtures/asset_host_mailer/email_with_asset.html.erb +0 -1
- data/test/fixtures/auto_layout_mailer/hello.html.erb +0 -1
- data/test/fixtures/auto_layout_mailer/multipart.text.html.erb +0 -1
- data/test/fixtures/auto_layout_mailer/multipart.text.plain.erb +0 -1
- data/test/fixtures/explicit_layout_mailer/logout.html.erb +0 -1
- data/test/fixtures/explicit_layout_mailer/signup.html.erb +0 -1
- data/test/fixtures/first_mailer/share.erb +0 -1
- data/test/fixtures/helper_mailer/use_example_helper.erb +0 -1
- data/test/fixtures/helper_mailer/use_helper.erb +0 -1
- data/test/fixtures/helper_mailer/use_helper_method.erb +0 -1
- data/test/fixtures/helper_mailer/use_mail_helper.erb +0 -5
- data/test/fixtures/helpers/example_helper.rb +0 -5
- data/test/fixtures/layouts/auto_layout_mailer.html.erb +0 -1
- data/test/fixtures/layouts/auto_layout_mailer.text.erb +0 -1
- data/test/fixtures/layouts/spam.html.erb +0 -1
- data/test/fixtures/path.with.dots/funky_path_mailer/multipart_with_template_path_with_dots.erb +0 -1
- data/test/fixtures/raw_email +0 -14
- data/test/fixtures/raw_email10 +0 -20
- data/test/fixtures/raw_email12 +0 -32
- data/test/fixtures/raw_email13 +0 -29
- data/test/fixtures/raw_email2 +0 -114
- data/test/fixtures/raw_email3 +0 -70
- data/test/fixtures/raw_email4 +0 -59
- data/test/fixtures/raw_email5 +0 -19
- data/test/fixtures/raw_email6 +0 -20
- data/test/fixtures/raw_email7 +0 -66
- data/test/fixtures/raw_email8 +0 -47
- data/test/fixtures/raw_email9 +0 -28
- data/test/fixtures/raw_email_quoted_with_0d0a +0 -14
- data/test/fixtures/raw_email_with_invalid_characters_in_content_type +0 -104
- data/test/fixtures/raw_email_with_nested_attachment +0 -100
- data/test/fixtures/raw_email_with_partially_quoted_subject +0 -14
- data/test/fixtures/second_mailer/share.erb +0 -1
- data/test/fixtures/templates/signed_up.erb +0 -3
- data/test/fixtures/test_mailer/_subtemplate.text.plain.erb +0 -1
- data/test/fixtures/test_mailer/body_ivar.erb +0 -2
- data/test/fixtures/test_mailer/custom_templating_extension.text.html.haml +0 -6
- data/test/fixtures/test_mailer/custom_templating_extension.text.plain.haml +0 -6
- data/test/fixtures/test_mailer/implicitly_multipart_example.ignored.erb +0 -1
- data/test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak +0 -1
- data/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb +0 -10
- data/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb~ +0 -10
- data/test/fixtures/test_mailer/implicitly_multipart_example.text.plain.erb +0 -2
- data/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.erb +0 -1
- data/test/fixtures/test_mailer/included_subtemplate.text.plain.erb +0 -1
- data/test/fixtures/test_mailer/rxml_template.builder +0 -2
- data/test/fixtures/test_mailer/rxml_template.rxml +0 -2
- data/test/fixtures/test_mailer/signed_up.html.erb +0 -3
- data/test/fixtures/test_mailer/signed_up_with_url.erb +0 -5
- data/test/mail_helper_test.rb +0 -95
- data/test/mail_layout_test.rb +0 -123
- data/test/mail_render_test.rb +0 -116
- data/test/mail_service_test.rb +0 -1145
- data/test/quoting_test.rb +0 -105
- data/test/test_helper_test.rb +0 -129
- data/test/tmail_test.rb +0 -22
- data/test/url_test.rb +0 -76
|
@@ -1,416 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# parser.y
|
|
3
|
-
#
|
|
4
|
-
# Copyright (c) 1998-2007 Minero Aoki
|
|
5
|
-
#
|
|
6
|
-
# This program is free software.
|
|
7
|
-
# You can distribute/modify this program under the terms of
|
|
8
|
-
# the GNU Lesser General Public License version 2.1.
|
|
9
|
-
#
|
|
10
|
-
|
|
11
|
-
class TMail::Parser
|
|
12
|
-
|
|
13
|
-
options no_result_var
|
|
14
|
-
|
|
15
|
-
rule
|
|
16
|
-
|
|
17
|
-
content : DATETIME datetime { val[1] }
|
|
18
|
-
| RECEIVED received { val[1] }
|
|
19
|
-
| MADDRESS addrs_TOP { val[1] }
|
|
20
|
-
| RETPATH retpath { val[1] }
|
|
21
|
-
| KEYWORDS keys { val[1] }
|
|
22
|
-
| ENCRYPTED enc { val[1] }
|
|
23
|
-
| MIMEVERSION version { val[1] }
|
|
24
|
-
| CTYPE ctype { val[1] }
|
|
25
|
-
| CENCODING cencode { val[1] }
|
|
26
|
-
| CDISPOSITION cdisp { val[1] }
|
|
27
|
-
| ADDRESS addr_TOP { val[1] }
|
|
28
|
-
| MAILBOX mbox { val[1] }
|
|
29
|
-
|
|
30
|
-
datetime : day DIGIT ATOM DIGIT hour zone
|
|
31
|
-
# 0 1 2 3 4 5
|
|
32
|
-
# date month year
|
|
33
|
-
{
|
|
34
|
-
t = Time.gm(val[3].to_i, val[2], val[1].to_i, 0, 0, 0)
|
|
35
|
-
(t + val[4] - val[5]).localtime
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
day : /* none */
|
|
39
|
-
| ATOM ','
|
|
40
|
-
|
|
41
|
-
hour : DIGIT ':' DIGIT
|
|
42
|
-
{
|
|
43
|
-
(val[0].to_i * 60 * 60) +
|
|
44
|
-
(val[2].to_i * 60)
|
|
45
|
-
}
|
|
46
|
-
| DIGIT ':' DIGIT ':' DIGIT
|
|
47
|
-
{
|
|
48
|
-
(val[0].to_i * 60 * 60) +
|
|
49
|
-
(val[2].to_i * 60) +
|
|
50
|
-
(val[4].to_i)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
zone : ATOM
|
|
54
|
-
{
|
|
55
|
-
timezone_string_to_unixtime(val[0])
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
received : from by via with id for received_datetime
|
|
59
|
-
{
|
|
60
|
-
val
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
from : /* none */
|
|
64
|
-
| FROM received_domain
|
|
65
|
-
{
|
|
66
|
-
val[1]
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
by : /* none */
|
|
70
|
-
| BY received_domain
|
|
71
|
-
{
|
|
72
|
-
val[1]
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
received_domain
|
|
76
|
-
: domain
|
|
77
|
-
{
|
|
78
|
-
join_domain(val[0])
|
|
79
|
-
}
|
|
80
|
-
| domain '@' domain
|
|
81
|
-
{
|
|
82
|
-
join_domain(val[2])
|
|
83
|
-
}
|
|
84
|
-
| domain DOMLIT
|
|
85
|
-
{
|
|
86
|
-
join_domain(val[0])
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
via : /* none */
|
|
90
|
-
| VIA ATOM
|
|
91
|
-
{
|
|
92
|
-
val[1]
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
with : /* none */
|
|
96
|
-
{
|
|
97
|
-
[]
|
|
98
|
-
}
|
|
99
|
-
| with WITH ATOM
|
|
100
|
-
{
|
|
101
|
-
val[0].push val[2]
|
|
102
|
-
val[0]
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
id : /* none */
|
|
106
|
-
| ID msgid
|
|
107
|
-
{
|
|
108
|
-
val[1]
|
|
109
|
-
}
|
|
110
|
-
| ID ATOM
|
|
111
|
-
{
|
|
112
|
-
val[1]
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
for : /* none */
|
|
116
|
-
| FOR received_addrspec
|
|
117
|
-
{
|
|
118
|
-
val[1]
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
received_addrspec
|
|
122
|
-
: routeaddr
|
|
123
|
-
{
|
|
124
|
-
val[0].spec
|
|
125
|
-
}
|
|
126
|
-
| spec
|
|
127
|
-
{
|
|
128
|
-
val[0].spec
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
received_datetime
|
|
132
|
-
: /* none */
|
|
133
|
-
| ';' datetime
|
|
134
|
-
{
|
|
135
|
-
val[1]
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
addrs_TOP : addrs
|
|
139
|
-
| group_bare
|
|
140
|
-
| addrs commas group_bare
|
|
141
|
-
|
|
142
|
-
addr_TOP : mbox
|
|
143
|
-
| group
|
|
144
|
-
| group_bare
|
|
145
|
-
|
|
146
|
-
retpath : addrs_TOP
|
|
147
|
-
| '<' '>' { [ Address.new(nil, nil) ] }
|
|
148
|
-
|
|
149
|
-
addrs : addr
|
|
150
|
-
{
|
|
151
|
-
val
|
|
152
|
-
}
|
|
153
|
-
| addrs commas addr
|
|
154
|
-
{
|
|
155
|
-
val[0].push val[2]
|
|
156
|
-
val[0]
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
addr : mbox
|
|
160
|
-
| group
|
|
161
|
-
|
|
162
|
-
mboxes : mbox
|
|
163
|
-
{
|
|
164
|
-
val
|
|
165
|
-
}
|
|
166
|
-
| mboxes commas mbox
|
|
167
|
-
{
|
|
168
|
-
val[0].push val[2]
|
|
169
|
-
val[0]
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
mbox : spec
|
|
173
|
-
| routeaddr
|
|
174
|
-
| addr_phrase routeaddr
|
|
175
|
-
{
|
|
176
|
-
val[1].phrase = Decoder.decode(val[0])
|
|
177
|
-
val[1]
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
group : group_bare ';'
|
|
181
|
-
|
|
182
|
-
group_bare: addr_phrase ':' mboxes
|
|
183
|
-
{
|
|
184
|
-
AddressGroup.new(val[0], val[2])
|
|
185
|
-
}
|
|
186
|
-
| addr_phrase ':' { AddressGroup.new(val[0], []) }
|
|
187
|
-
|
|
188
|
-
addr_phrase
|
|
189
|
-
: local_head { val[0].join('.') }
|
|
190
|
-
| addr_phrase local_head { val[0] << ' ' << val[1].join('.') }
|
|
191
|
-
|
|
192
|
-
routeaddr : '<' routes spec '>'
|
|
193
|
-
{
|
|
194
|
-
val[2].routes.replace val[1]
|
|
195
|
-
val[2]
|
|
196
|
-
}
|
|
197
|
-
| '<' spec '>'
|
|
198
|
-
{
|
|
199
|
-
val[1]
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
routes : at_domains ':'
|
|
203
|
-
|
|
204
|
-
at_domains: '@' domain { [ val[1].join('.') ] }
|
|
205
|
-
| at_domains ',' '@' domain { val[0].push val[3].join('.'); val[0] }
|
|
206
|
-
|
|
207
|
-
spec : local '@' domain { Address.new( val[0], val[2] ) }
|
|
208
|
-
| local { Address.new( val[0], nil ) }
|
|
209
|
-
|
|
210
|
-
local: local_head
|
|
211
|
-
| local_head '.' { val[0].push ''; val[0] }
|
|
212
|
-
|
|
213
|
-
local_head: word
|
|
214
|
-
{ val }
|
|
215
|
-
| local_head dots word
|
|
216
|
-
{
|
|
217
|
-
val[1].times do
|
|
218
|
-
val[0].push ''
|
|
219
|
-
end
|
|
220
|
-
val[0].push val[2]
|
|
221
|
-
val[0]
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
domain : domword
|
|
225
|
-
{ val }
|
|
226
|
-
| domain dots domword
|
|
227
|
-
{
|
|
228
|
-
val[1].times do
|
|
229
|
-
val[0].push ''
|
|
230
|
-
end
|
|
231
|
-
val[0].push val[2]
|
|
232
|
-
val[0]
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
dots : '.' { 0 }
|
|
236
|
-
| dots '.' { val[0] + 1 }
|
|
237
|
-
|
|
238
|
-
word : atom
|
|
239
|
-
| QUOTED
|
|
240
|
-
| DIGIT
|
|
241
|
-
|
|
242
|
-
domword : atom
|
|
243
|
-
| DOMLIT
|
|
244
|
-
| DIGIT
|
|
245
|
-
|
|
246
|
-
commas : ','
|
|
247
|
-
| commas ','
|
|
248
|
-
|
|
249
|
-
msgid : '<' spec '>'
|
|
250
|
-
{
|
|
251
|
-
val[1] = val[1].spec
|
|
252
|
-
val.join('')
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
keys : phrase { val }
|
|
256
|
-
| keys ',' phrase { val[0].push val[2]; val[0] }
|
|
257
|
-
|
|
258
|
-
phrase : word
|
|
259
|
-
| phrase word { val[0] << ' ' << val[1] }
|
|
260
|
-
|
|
261
|
-
enc : word
|
|
262
|
-
{
|
|
263
|
-
val.push nil
|
|
264
|
-
val
|
|
265
|
-
}
|
|
266
|
-
| word word
|
|
267
|
-
{
|
|
268
|
-
val
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
version : DIGIT '.' DIGIT
|
|
272
|
-
{
|
|
273
|
-
[ val[0].to_i, val[2].to_i ]
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
ctype : TOKEN '/' TOKEN params opt_semicolon
|
|
277
|
-
{
|
|
278
|
-
[ val[0].downcase, val[2].downcase, decode_params(val[3]) ]
|
|
279
|
-
}
|
|
280
|
-
| TOKEN params opt_semicolon
|
|
281
|
-
{
|
|
282
|
-
[ val[0].downcase, nil, decode_params(val[1]) ]
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
params : /* none */
|
|
286
|
-
{
|
|
287
|
-
{}
|
|
288
|
-
}
|
|
289
|
-
| params ';' TOKEN '=' QUOTED
|
|
290
|
-
{
|
|
291
|
-
val[0][ val[2].downcase ] = ('"' + val[4].to_s + '"')
|
|
292
|
-
val[0]
|
|
293
|
-
}
|
|
294
|
-
| params ';' TOKEN '=' TOKEN
|
|
295
|
-
{
|
|
296
|
-
val[0][ val[2].downcase ] = val[4]
|
|
297
|
-
val[0]
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
cencode : TOKEN
|
|
301
|
-
{
|
|
302
|
-
val[0].downcase
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
cdisp : TOKEN params opt_semicolon
|
|
306
|
-
{
|
|
307
|
-
[ val[0].downcase, decode_params(val[1]) ]
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
opt_semicolon
|
|
311
|
-
:
|
|
312
|
-
| ';'
|
|
313
|
-
|
|
314
|
-
atom : ATOM
|
|
315
|
-
| FROM
|
|
316
|
-
| BY
|
|
317
|
-
| VIA
|
|
318
|
-
| WITH
|
|
319
|
-
| ID
|
|
320
|
-
| FOR
|
|
321
|
-
|
|
322
|
-
end
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
---- header
|
|
326
|
-
#
|
|
327
|
-
# parser.rb
|
|
328
|
-
#
|
|
329
|
-
# Copyright (c) 1998-2007 Minero Aoki
|
|
330
|
-
#
|
|
331
|
-
# This program is free software.
|
|
332
|
-
# You can distribute/modify this program under the terms of
|
|
333
|
-
# the GNU Lesser General Public License version 2.1.
|
|
334
|
-
#
|
|
335
|
-
|
|
336
|
-
require 'tmail/scanner'
|
|
337
|
-
require 'tmail/utils'
|
|
338
|
-
|
|
339
|
-
---- inner
|
|
340
|
-
|
|
341
|
-
include TextUtils
|
|
342
|
-
|
|
343
|
-
def self.parse( ident, str, cmt = nil )
|
|
344
|
-
str = special_quote_address(str) if ident.to_s =~ /M?ADDRESS/
|
|
345
|
-
new.parse(ident, str, cmt)
|
|
346
|
-
end
|
|
347
|
-
|
|
348
|
-
def self.special_quote_address(str) #:nodoc:
|
|
349
|
-
# Takes a string which is an address and adds quotation marks to special
|
|
350
|
-
# edge case methods that the RACC parser can not handle.
|
|
351
|
-
#
|
|
352
|
-
# Right now just handles two edge cases:
|
|
353
|
-
#
|
|
354
|
-
# Full stop as the last character of the display name:
|
|
355
|
-
# Mikel L. <mikel@me.com>
|
|
356
|
-
# Returns:
|
|
357
|
-
# "Mikel L." <mikel@me.com>
|
|
358
|
-
#
|
|
359
|
-
# Unquoted @ symbol in the display name:
|
|
360
|
-
# mikel@me.com <mikel@me.com>
|
|
361
|
-
# Returns:
|
|
362
|
-
# "mikel@me.com" <mikel@me.com>
|
|
363
|
-
#
|
|
364
|
-
# Any other address not matching these patterns just gets returned as is.
|
|
365
|
-
case
|
|
366
|
-
# This handles the missing "" in an older version of Apple Mail.app
|
|
367
|
-
# around the display name when the display name contains a '@'
|
|
368
|
-
# like 'mikel@me.com <mikel@me.com>'
|
|
369
|
-
# Just quotes it to: '"mikel@me.com" <mikel@me.com>'
|
|
370
|
-
when str =~ /\A([^"].+@.+[^"])\s(<.*?>)\Z/
|
|
371
|
-
return "\"#{$1}\" #{$2}"
|
|
372
|
-
# This handles cases where 'Mikel A. <mikel@me.com>' which is a trailing
|
|
373
|
-
# full stop before the address section. Just quotes it to
|
|
374
|
-
# '"Mikel A." <mikel@me.com>'
|
|
375
|
-
when str =~ /\A(.*?\.)\s(<.*?>)\s*\Z/
|
|
376
|
-
return "\"#{$1}\" #{$2}"
|
|
377
|
-
else
|
|
378
|
-
str
|
|
379
|
-
end
|
|
380
|
-
end
|
|
381
|
-
|
|
382
|
-
MAILP_DEBUG = false
|
|
383
|
-
|
|
384
|
-
def initialize
|
|
385
|
-
self.debug = MAILP_DEBUG
|
|
386
|
-
end
|
|
387
|
-
|
|
388
|
-
def debug=( flag )
|
|
389
|
-
@yydebug = flag && Racc_debug_parser
|
|
390
|
-
@scanner_debug = flag
|
|
391
|
-
end
|
|
392
|
-
|
|
393
|
-
def debug
|
|
394
|
-
@yydebug
|
|
395
|
-
end
|
|
396
|
-
|
|
397
|
-
def parse( ident, str, comments = nil )
|
|
398
|
-
@scanner = Scanner.new(str, ident, comments)
|
|
399
|
-
@scanner.debug = @scanner_debug
|
|
400
|
-
@first = [ident, ident]
|
|
401
|
-
result = yyparse(self, :parse_in)
|
|
402
|
-
comments.map! {|c| to_kcode(c) } if comments
|
|
403
|
-
result
|
|
404
|
-
end
|
|
405
|
-
|
|
406
|
-
private
|
|
407
|
-
|
|
408
|
-
def parse_in( &block )
|
|
409
|
-
yield @first
|
|
410
|
-
@scanner.scan(&block)
|
|
411
|
-
end
|
|
412
|
-
|
|
413
|
-
def on_error( t, val, vstack )
|
|
414
|
-
raise TMail::SyntaxError, "parse error on token #{racc_token2str t}"
|
|
415
|
-
end
|
|
416
|
-
|