actionmailer-2.3.17-rack-upgrade 2.3.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. data/CHANGELOG +387 -0
  2. data/MIT-LICENSE +21 -0
  3. data/README +149 -0
  4. data/Rakefile +97 -0
  5. data/install.rb +30 -0
  6. data/lib/action_mailer.rb +62 -0
  7. data/lib/action_mailer/adv_attr_accessor.rb +30 -0
  8. data/lib/action_mailer/base.rb +739 -0
  9. data/lib/action_mailer/helpers.rb +113 -0
  10. data/lib/action_mailer/mail_helper.rb +17 -0
  11. data/lib/action_mailer/part.rb +107 -0
  12. data/lib/action_mailer/part_container.rb +55 -0
  13. data/lib/action_mailer/quoting.rb +62 -0
  14. data/lib/action_mailer/test_case.rb +64 -0
  15. data/lib/action_mailer/test_helper.rb +68 -0
  16. data/lib/action_mailer/utils.rb +7 -0
  17. data/lib/action_mailer/vendor/text-format-0.6.3/text/format.rb +1466 -0
  18. data/lib/action_mailer/vendor/text_format.rb +10 -0
  19. data/lib/action_mailer/vendor/tmail-1.2.7/tmail.rb +6 -0
  20. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/Makefile +18 -0
  21. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/address.rb +392 -0
  22. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/attachments.rb +65 -0
  23. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/base64.rb +46 -0
  24. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/compat.rb +41 -0
  25. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/config.rb +67 -0
  26. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/core_extensions.rb +63 -0
  27. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/encode.rb +590 -0
  28. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/header.rb +962 -0
  29. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/index.rb +9 -0
  30. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/interface.rb +1162 -0
  31. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/loader.rb +3 -0
  32. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/mail.rb +578 -0
  33. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/mailbox.rb +496 -0
  34. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/main.rb +6 -0
  35. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/mbox.rb +3 -0
  36. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/net.rb +250 -0
  37. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/obsolete.rb +132 -0
  38. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/parser.rb +1060 -0
  39. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/parser.y +416 -0
  40. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/port.rb +379 -0
  41. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/quoting.rb +164 -0
  42. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/require_arch.rb +58 -0
  43. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/scanner.rb +49 -0
  44. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/scanner_r.rb +262 -0
  45. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/stringio.rb +280 -0
  46. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/utils.rb +362 -0
  47. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/COPYING +504 -0
  48. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/README +12 -0
  49. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet.rb +67 -0
  50. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/big5freq.rb +927 -0
  51. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/big5prober.rb +42 -0
  52. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/chardistribution.rb +238 -0
  53. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/charsetgroupprober.rb +112 -0
  54. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/charsetprober.rb +75 -0
  55. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/codingstatemachine.rb +64 -0
  56. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/constants.rb +42 -0
  57. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/escprober.rb +89 -0
  58. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/escsm.rb +244 -0
  59. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/eucjpprober.rb +88 -0
  60. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euckrfreq.rb +596 -0
  61. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euckrprober.rb +42 -0
  62. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euctwfreq.rb +430 -0
  63. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euctwprober.rb +42 -0
  64. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312freq.rb +474 -0
  65. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312prober.rb +42 -0
  66. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/hebrewprober.rb +289 -0
  67. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/jisfreq.rb +570 -0
  68. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/jpcntx.rb +229 -0
  69. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langbulgarianmodel.rb +229 -0
  70. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langcyrillicmodel.rb +330 -0
  71. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langgreekmodel.rb +227 -0
  72. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langhebrewmodel.rb +202 -0
  73. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langhungarianmodel.rb +226 -0
  74. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langthaimodel.rb +201 -0
  75. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/latin1prober.rb +147 -0
  76. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/mbcharsetprober.rb +89 -0
  77. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/mbcsgroupprober.rb +45 -0
  78. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/mbcssm.rb +542 -0
  79. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sbcharsetprober.rb +124 -0
  80. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sbcsgroupprober.rb +56 -0
  81. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sjisprober.rb +88 -0
  82. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/universaldetector.rb +168 -0
  83. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/utf8prober.rb +87 -0
  84. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/version.rb +39 -0
  85. data/lib/action_mailer/vendor/tmail.rb +17 -0
  86. data/lib/action_mailer/version.rb +9 -0
  87. data/lib/actionmailer.rb +2 -0
  88. data/test/abstract_unit.rb +62 -0
  89. data/test/asset_host_test.rb +54 -0
  90. data/test/delivery_method_test.rb +51 -0
  91. data/test/fixtures/asset_host_mailer/email_with_asset.html.erb +1 -0
  92. data/test/fixtures/auto_layout_mailer/hello.html.erb +1 -0
  93. data/test/fixtures/auto_layout_mailer/multipart.text.html.erb +1 -0
  94. data/test/fixtures/auto_layout_mailer/multipart.text.plain.erb +1 -0
  95. data/test/fixtures/explicit_layout_mailer/logout.html.erb +1 -0
  96. data/test/fixtures/explicit_layout_mailer/signup.html.erb +1 -0
  97. data/test/fixtures/first_mailer/share.erb +1 -0
  98. data/test/fixtures/helper_mailer/use_example_helper.erb +1 -0
  99. data/test/fixtures/helper_mailer/use_helper.erb +1 -0
  100. data/test/fixtures/helper_mailer/use_helper_method.erb +1 -0
  101. data/test/fixtures/helper_mailer/use_mail_helper.erb +5 -0
  102. data/test/fixtures/helpers/example_helper.rb +5 -0
  103. data/test/fixtures/layouts/auto_layout_mailer.html.erb +1 -0
  104. data/test/fixtures/layouts/auto_layout_mailer.text.erb +1 -0
  105. data/test/fixtures/layouts/spam.html.erb +1 -0
  106. data/test/fixtures/path.with.dots/funky_path_mailer/multipart_with_template_path_with_dots.erb +1 -0
  107. data/test/fixtures/raw_email +14 -0
  108. data/test/fixtures/raw_email10 +20 -0
  109. data/test/fixtures/raw_email12 +32 -0
  110. data/test/fixtures/raw_email13 +29 -0
  111. data/test/fixtures/raw_email2 +114 -0
  112. data/test/fixtures/raw_email3 +70 -0
  113. data/test/fixtures/raw_email4 +59 -0
  114. data/test/fixtures/raw_email5 +19 -0
  115. data/test/fixtures/raw_email6 +20 -0
  116. data/test/fixtures/raw_email7 +66 -0
  117. data/test/fixtures/raw_email8 +47 -0
  118. data/test/fixtures/raw_email9 +28 -0
  119. data/test/fixtures/raw_email_quoted_with_0d0a +14 -0
  120. data/test/fixtures/raw_email_with_invalid_characters_in_content_type +104 -0
  121. data/test/fixtures/raw_email_with_nested_attachment +100 -0
  122. data/test/fixtures/raw_email_with_partially_quoted_subject +14 -0
  123. data/test/fixtures/second_mailer/share.erb +1 -0
  124. data/test/fixtures/templates/signed_up.erb +3 -0
  125. data/test/fixtures/test_mailer/_subtemplate.text.plain.erb +1 -0
  126. data/test/fixtures/test_mailer/body_ivar.erb +2 -0
  127. data/test/fixtures/test_mailer/custom_templating_extension.text.html.haml +6 -0
  128. data/test/fixtures/test_mailer/custom_templating_extension.text.plain.haml +6 -0
  129. data/test/fixtures/test_mailer/implicitly_multipart_example.ignored.erb +1 -0
  130. data/test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak +1 -0
  131. data/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb +10 -0
  132. data/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb~ +10 -0
  133. data/test/fixtures/test_mailer/implicitly_multipart_example.text.plain.erb +2 -0
  134. data/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.erb +1 -0
  135. data/test/fixtures/test_mailer/included_subtemplate.text.plain.erb +1 -0
  136. data/test/fixtures/test_mailer/rxml_template.builder +2 -0
  137. data/test/fixtures/test_mailer/rxml_template.rxml +2 -0
  138. data/test/fixtures/test_mailer/signed_up.html.erb +3 -0
  139. data/test/fixtures/test_mailer/signed_up_with_url.erb +5 -0
  140. data/test/mail_helper_test.rb +95 -0
  141. data/test/mail_layout_test.rb +123 -0
  142. data/test/mail_render_test.rb +116 -0
  143. data/test/mail_service_test.rb +1145 -0
  144. data/test/quoting_test.rb +105 -0
  145. data/test/test_helper_test.rb +129 -0
  146. data/test/tmail_test.rb +22 -0
  147. data/test/url_test.rb +76 -0
  148. metadata +209 -0
@@ -0,0 +1,6 @@
1
+ #:stopdoc:
2
+ require 'tmail/version'
3
+ require 'tmail/mail'
4
+ require 'tmail/mailbox'
5
+ require 'tmail/core_extensions'
6
+ #:startdoc:
@@ -0,0 +1,3 @@
1
+ #:stopdoc:
2
+ require 'tmail/mailbox'
3
+ #:startdoc:
@@ -0,0 +1,250 @@
1
+ #--
2
+ # Copyright (c) 1998-2003 Minero Aoki <aamine@loveruby.net>
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #
23
+ # Note: Originally licensed under LGPL v2+. Using MIT license for Rails
24
+ # with permission of Minero Aoki.
25
+ #++
26
+
27
+ #:stopdoc:
28
+ require 'nkf'
29
+ #:startdoc:
30
+
31
+ module TMail
32
+
33
+ class Mail
34
+
35
+ def send_to( smtp )
36
+ do_send_to(smtp) do
37
+ ready_to_send
38
+ end
39
+ end
40
+
41
+ def send_text_to( smtp )
42
+ do_send_to(smtp) do
43
+ ready_to_send
44
+ mime_encode
45
+ end
46
+ end
47
+
48
+ def do_send_to( smtp )
49
+ from = from_address or raise ArgumentError, 'no from address'
50
+ (dests = destinations).empty? and raise ArgumentError, 'no receipient'
51
+ yield
52
+ send_to_0 smtp, from, dests
53
+ end
54
+ private :do_send_to
55
+
56
+ def send_to_0( smtp, from, to )
57
+ smtp.ready(from, to) do |f|
58
+ encoded "\r\n", 'j', f, ''
59
+ end
60
+ end
61
+
62
+ def ready_to_send
63
+ delete_no_send_fields
64
+ add_message_id
65
+ add_date
66
+ end
67
+
68
+ NOSEND_FIELDS = %w(
69
+ received
70
+ bcc
71
+ )
72
+
73
+ def delete_no_send_fields
74
+ NOSEND_FIELDS.each do |nm|
75
+ delete nm
76
+ end
77
+ delete_if {|n,v| v.empty? }
78
+ end
79
+
80
+ def add_message_id( fqdn = nil )
81
+ unless @message_id_enforced
82
+ self.message_id = ::TMail::new_message_id(fqdn)
83
+ end
84
+ end
85
+
86
+ def add_date
87
+ self.date = Time.now
88
+ end
89
+
90
+ def mime_encode
91
+ if parts.empty?
92
+ mime_encode_singlepart
93
+ else
94
+ mime_encode_multipart true
95
+ end
96
+ end
97
+
98
+ def mime_encode_singlepart
99
+ self.mime_version = '1.0'
100
+ b = body
101
+ if NKF.guess(b) != NKF::BINARY
102
+ mime_encode_text b
103
+ else
104
+ mime_encode_binary b
105
+ end
106
+ end
107
+
108
+ def mime_encode_text( body )
109
+ self.body = NKF.nkf('-j -m0', body)
110
+ self.set_content_type 'text', 'plain', {'charset' => 'iso-2022-jp'}
111
+ self.encoding = '7bit'
112
+ end
113
+
114
+ def mime_encode_binary( body )
115
+ self.body = [body].pack('m')
116
+ self.set_content_type 'application', 'octet-stream'
117
+ self.encoding = 'Base64'
118
+ end
119
+
120
+ def mime_encode_multipart( top = true )
121
+ self.mime_version = '1.0' if top
122
+ self.set_content_type 'multipart', 'mixed'
123
+ e = encoding(nil)
124
+ if e and not /\A(?:7bit|8bit|binary)\z/i === e
125
+ raise ArgumentError,
126
+ 'using C.T.Encoding with multipart mail is not permitted'
127
+ end
128
+ end
129
+
130
+ end
131
+
132
+ #:stopdoc:
133
+ class DeleteFields
134
+
135
+ NOSEND_FIELDS = %w(
136
+ received
137
+ bcc
138
+ )
139
+
140
+ def initialize( nosend = nil, delempty = true )
141
+ @no_send_fields = nosend || NOSEND_FIELDS.dup
142
+ @delete_empty_fields = delempty
143
+ end
144
+
145
+ attr :no_send_fields
146
+ attr :delete_empty_fields, true
147
+
148
+ def exec( mail )
149
+ @no_send_fields.each do |nm|
150
+ delete nm
151
+ end
152
+ delete_if {|n,v| v.empty? } if @delete_empty_fields
153
+ end
154
+
155
+ end
156
+ #:startdoc:
157
+
158
+ #:stopdoc:
159
+ class AddMessageId
160
+
161
+ def initialize( fqdn = nil )
162
+ @fqdn = fqdn
163
+ end
164
+
165
+ attr :fqdn, true
166
+
167
+ def exec( mail )
168
+ mail.message_id = ::TMail::new_msgid(@fqdn)
169
+ end
170
+
171
+ end
172
+ #:startdoc:
173
+
174
+ #:stopdoc:
175
+ class AddDate
176
+
177
+ def exec( mail )
178
+ mail.date = Time.now
179
+ end
180
+
181
+ end
182
+ #:startdoc:
183
+
184
+ #:stopdoc:
185
+ class MimeEncodeAuto
186
+
187
+ def initialize( s = nil, m = nil )
188
+ @singlepart_composer = s || MimeEncodeSingle.new
189
+ @multipart_composer = m || MimeEncodeMulti.new
190
+ end
191
+
192
+ attr :singlepart_composer
193
+ attr :multipart_composer
194
+
195
+ def exec( mail )
196
+ if mail._builtin_multipart?
197
+ then @multipart_composer
198
+ else @singlepart_composer end.exec mail
199
+ end
200
+
201
+ end
202
+ #:startdoc:
203
+
204
+ #:stopdoc:
205
+ class MimeEncodeSingle
206
+
207
+ def exec( mail )
208
+ mail.mime_version = '1.0'
209
+ b = mail.body
210
+ if NKF.guess(b) != NKF::BINARY
211
+ on_text b
212
+ else
213
+ on_binary b
214
+ end
215
+ end
216
+
217
+ def on_text( body )
218
+ mail.body = NKF.nkf('-j -m0', body)
219
+ mail.set_content_type 'text', 'plain', {'charset' => 'iso-2022-jp'}
220
+ mail.encoding = '7bit'
221
+ end
222
+
223
+ def on_binary( body )
224
+ mail.body = [body].pack('m')
225
+ mail.set_content_type 'application', 'octet-stream'
226
+ mail.encoding = 'Base64'
227
+ end
228
+
229
+ end
230
+ #:startdoc:
231
+
232
+ #:stopdoc:
233
+ class MimeEncodeMulti
234
+
235
+ def exec( mail, top = true )
236
+ mail.mime_version = '1.0' if top
237
+ mail.set_content_type 'multipart', 'mixed'
238
+ e = encoding(nil)
239
+ if e and not /\A(?:7bit|8bit|binary)\z/i === e
240
+ raise ArgumentError,
241
+ 'using C.T.Encoding with multipart mail is not permitted'
242
+ end
243
+ mail.parts.each do |m|
244
+ exec m, false if m._builtin_multipart?
245
+ end
246
+ end
247
+
248
+ end
249
+ #:startdoc:
250
+ end # module TMail
@@ -0,0 +1,132 @@
1
+ =begin rdoc
2
+
3
+ = Obsolete methods that are depriciated
4
+
5
+ If you really want to see them, go to lib/tmail/obsolete.rb and view to your
6
+ heart's content.
7
+
8
+ =end
9
+ #--
10
+ # Copyright (c) 1998-2003 Minero Aoki <aamine@loveruby.net>
11
+ #
12
+ # Permission is hereby granted, free of charge, to any person obtaining
13
+ # a copy of this software and associated documentation files (the
14
+ # "Software"), to deal in the Software without restriction, including
15
+ # without limitation the rights to use, copy, modify, merge, publish,
16
+ # distribute, sublicense, and/or sell copies of the Software, and to
17
+ # permit persons to whom the Software is furnished to do so, subject to
18
+ # the following conditions:
19
+ #
20
+ # The above copyright notice and this permission notice shall be
21
+ # included in all copies or substantial portions of the Software.
22
+ #
23
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30
+ #
31
+ # Note: Originally licensed under LGPL v2+. Using MIT license for Rails
32
+ # with permission of Minero Aoki.
33
+ #++
34
+ #:stopdoc:
35
+ module TMail #:nodoc:
36
+
37
+ class Mail
38
+ alias include? key?
39
+ alias has_key? key?
40
+
41
+ def values
42
+ ret = []
43
+ each_field {|v| ret.push v }
44
+ ret
45
+ end
46
+
47
+ def value?( val )
48
+ HeaderField === val or return false
49
+
50
+ [ @header[val.name.downcase] ].flatten.include? val
51
+ end
52
+
53
+ alias has_value? value?
54
+ end
55
+
56
+ class Mail
57
+ def from_addr( default = nil )
58
+ addr, = from_addrs(nil)
59
+ addr || default
60
+ end
61
+
62
+ def from_address( default = nil )
63
+ if a = from_addr(nil)
64
+ a.spec
65
+ else
66
+ default
67
+ end
68
+ end
69
+
70
+ alias from_address= from_addrs=
71
+
72
+ def from_phrase( default = nil )
73
+ if a = from_addr(nil)
74
+ a.phrase
75
+ else
76
+ default
77
+ end
78
+ end
79
+
80
+ alias msgid message_id
81
+ alias msgid= message_id=
82
+
83
+ alias each_dest each_destination
84
+ end
85
+
86
+ class Address
87
+ alias route routes
88
+ alias addr spec
89
+
90
+ def spec=( str )
91
+ @local, @domain = str.split(/@/,2).map {|s| s.split(/\./) }
92
+ end
93
+
94
+ alias addr= spec=
95
+ alias address= spec=
96
+ end
97
+
98
+ class MhMailbox
99
+ alias new_mail new_port
100
+ alias each_mail each_port
101
+ alias each_newmail each_new_port
102
+ end
103
+ class UNIXMbox
104
+ alias new_mail new_port
105
+ alias each_mail each_port
106
+ alias each_newmail each_new_port
107
+ end
108
+ class Maildir
109
+ alias new_mail new_port
110
+ alias each_mail each_port
111
+ alias each_newmail each_new_port
112
+ end
113
+
114
+ extend TextUtils
115
+
116
+ class << self
117
+ alias msgid? message_id?
118
+ alias boundary new_boundary
119
+ alias msgid new_message_id
120
+ alias new_msgid new_message_id
121
+ end
122
+
123
+ def Mail.boundary
124
+ ::TMail.new_boundary
125
+ end
126
+
127
+ def Mail.msgid
128
+ ::TMail.new_message_id
129
+ end
130
+
131
+ end # module TMail
132
+ #:startdoc:
@@ -0,0 +1,1060 @@
1
+ #
2
+ # DO NOT MODIFY!!!!
3
+ # This file is automatically generated by racc 1.4.5
4
+ # from racc grammer file "lib/tmail/parser.y".
5
+ #
6
+
7
+ require 'racc/parser'
8
+
9
+
10
+ #
11
+ # parser.rb
12
+ #
13
+ # Copyright (c) 1998-2007 Minero Aoki
14
+ #
15
+ # This program is free software.
16
+ # You can distribute/modify this program under the terms of
17
+ # the GNU Lesser General Public License version 2.1.
18
+ #
19
+
20
+ require 'tmail/scanner'
21
+ require 'tmail/utils'
22
+
23
+
24
+ module TMail
25
+
26
+ class Parser < Racc::Parser
27
+
28
+ module_eval <<'..end lib/tmail/parser.y modeval..id2dd1c7d21d', 'lib/tmail/parser.y', 340
29
+
30
+ include TextUtils
31
+
32
+ def self.parse( ident, str, cmt = nil )
33
+ str = special_quote_address(str) if ident.to_s =~ /M?ADDRESS/
34
+ new.parse(ident, str, cmt)
35
+ end
36
+
37
+ def self.special_quote_address(str) #:nodoc:
38
+ # Takes a string which is an address and adds quotation marks to special
39
+ # edge case methods that the RACC parser can not handle.
40
+ #
41
+ # Right now just handles two edge cases:
42
+ #
43
+ # Full stop as the last character of the display name:
44
+ # Mikel L. <mikel@me.com>
45
+ # Returns:
46
+ # "Mikel L." <mikel@me.com>
47
+ #
48
+ # Unquoted @ symbol in the display name:
49
+ # mikel@me.com <mikel@me.com>
50
+ # Returns:
51
+ # "mikel@me.com" <mikel@me.com>
52
+ #
53
+ # Any other address not matching these patterns just gets returned as is.
54
+ case
55
+ # This handles the missing "" in an older version of Apple Mail.app
56
+ # around the display name when the display name contains a '@'
57
+ # like 'mikel@me.com <mikel@me.com>'
58
+ # Just quotes it to: '"mikel@me.com" <mikel@me.com>'
59
+ when str =~ /\A([^"].+@.+[^"])\s(<.*?>)\Z/
60
+ return "\"#{$1}\" #{$2}"
61
+ # This handles cases where 'Mikel A. <mikel@me.com>' which is a trailing
62
+ # full stop before the address section. Just quotes it to
63
+ # '"Mikel A." <mikel@me.com>'
64
+ when str =~ /\A(.*?\.)\s(<.*?>)\s*\Z/
65
+ return "\"#{$1}\" #{$2}"
66
+ else
67
+ str
68
+ end
69
+ end
70
+
71
+ MAILP_DEBUG = false
72
+
73
+ def initialize
74
+ self.debug = MAILP_DEBUG
75
+ end
76
+
77
+ def debug=( flag )
78
+ @yydebug = flag && Racc_debug_parser
79
+ @scanner_debug = flag
80
+ end
81
+
82
+ def debug
83
+ @yydebug
84
+ end
85
+
86
+ def parse( ident, str, comments = nil )
87
+ @scanner = Scanner.new(str, ident, comments)
88
+ @scanner.debug = @scanner_debug
89
+ @first = [ident, ident]
90
+ result = yyparse(self, :parse_in)
91
+ comments.map! {|c| to_kcode(c) } if comments
92
+ result
93
+ end
94
+
95
+ private
96
+
97
+ def parse_in( &block )
98
+ yield @first
99
+ @scanner.scan(&block)
100
+ end
101
+
102
+ def on_error( t, val, vstack )
103
+ raise TMail::SyntaxError, "parse error on token #{racc_token2str t}"
104
+ end
105
+
106
+ ..end lib/tmail/parser.y modeval..id2dd1c7d21d
107
+
108
+ ##### racc 1.4.5 generates ###
109
+
110
+ racc_reduce_table = [
111
+ 0, 0, :racc_error,
112
+ 2, 35, :_reduce_1,
113
+ 2, 35, :_reduce_2,
114
+ 2, 35, :_reduce_3,
115
+ 2, 35, :_reduce_4,
116
+ 2, 35, :_reduce_5,
117
+ 2, 35, :_reduce_6,
118
+ 2, 35, :_reduce_7,
119
+ 2, 35, :_reduce_8,
120
+ 2, 35, :_reduce_9,
121
+ 2, 35, :_reduce_10,
122
+ 2, 35, :_reduce_11,
123
+ 2, 35, :_reduce_12,
124
+ 6, 36, :_reduce_13,
125
+ 0, 48, :_reduce_none,
126
+ 2, 48, :_reduce_none,
127
+ 3, 49, :_reduce_16,
128
+ 5, 49, :_reduce_17,
129
+ 1, 50, :_reduce_18,
130
+ 7, 37, :_reduce_19,
131
+ 0, 51, :_reduce_none,
132
+ 2, 51, :_reduce_21,
133
+ 0, 52, :_reduce_none,
134
+ 2, 52, :_reduce_23,
135
+ 1, 58, :_reduce_24,
136
+ 3, 58, :_reduce_25,
137
+ 2, 58, :_reduce_26,
138
+ 0, 53, :_reduce_none,
139
+ 2, 53, :_reduce_28,
140
+ 0, 54, :_reduce_29,
141
+ 3, 54, :_reduce_30,
142
+ 0, 55, :_reduce_none,
143
+ 2, 55, :_reduce_32,
144
+ 2, 55, :_reduce_33,
145
+ 0, 56, :_reduce_none,
146
+ 2, 56, :_reduce_35,
147
+ 1, 61, :_reduce_36,
148
+ 1, 61, :_reduce_37,
149
+ 0, 57, :_reduce_none,
150
+ 2, 57, :_reduce_39,
151
+ 1, 38, :_reduce_none,
152
+ 1, 38, :_reduce_none,
153
+ 3, 38, :_reduce_none,
154
+ 1, 46, :_reduce_none,
155
+ 1, 46, :_reduce_none,
156
+ 1, 46, :_reduce_none,
157
+ 1, 39, :_reduce_none,
158
+ 2, 39, :_reduce_47,
159
+ 1, 64, :_reduce_48,
160
+ 3, 64, :_reduce_49,
161
+ 1, 68, :_reduce_none,
162
+ 1, 68, :_reduce_none,
163
+ 1, 69, :_reduce_52,
164
+ 3, 69, :_reduce_53,
165
+ 1, 47, :_reduce_none,
166
+ 1, 47, :_reduce_none,
167
+ 2, 47, :_reduce_56,
168
+ 2, 67, :_reduce_none,
169
+ 3, 65, :_reduce_58,
170
+ 2, 65, :_reduce_59,
171
+ 1, 70, :_reduce_60,
172
+ 2, 70, :_reduce_61,
173
+ 4, 62, :_reduce_62,
174
+ 3, 62, :_reduce_63,
175
+ 2, 72, :_reduce_none,
176
+ 2, 73, :_reduce_65,
177
+ 4, 73, :_reduce_66,
178
+ 3, 63, :_reduce_67,
179
+ 1, 63, :_reduce_68,
180
+ 1, 74, :_reduce_none,
181
+ 2, 74, :_reduce_70,
182
+ 1, 71, :_reduce_71,
183
+ 3, 71, :_reduce_72,
184
+ 1, 59, :_reduce_73,
185
+ 3, 59, :_reduce_74,
186
+ 1, 76, :_reduce_75,
187
+ 2, 76, :_reduce_76,
188
+ 1, 75, :_reduce_none,
189
+ 1, 75, :_reduce_none,
190
+ 1, 75, :_reduce_none,
191
+ 1, 77, :_reduce_none,
192
+ 1, 77, :_reduce_none,
193
+ 1, 77, :_reduce_none,
194
+ 1, 66, :_reduce_none,
195
+ 2, 66, :_reduce_none,
196
+ 3, 60, :_reduce_85,
197
+ 1, 40, :_reduce_86,
198
+ 3, 40, :_reduce_87,
199
+ 1, 79, :_reduce_none,
200
+ 2, 79, :_reduce_89,
201
+ 1, 41, :_reduce_90,
202
+ 2, 41, :_reduce_91,
203
+ 3, 42, :_reduce_92,
204
+ 5, 43, :_reduce_93,
205
+ 3, 43, :_reduce_94,
206
+ 0, 80, :_reduce_95,
207
+ 5, 80, :_reduce_96,
208
+ 5, 80, :_reduce_97,
209
+ 1, 44, :_reduce_98,
210
+ 3, 45, :_reduce_99,
211
+ 0, 81, :_reduce_none,
212
+ 1, 81, :_reduce_none,
213
+ 1, 78, :_reduce_none,
214
+ 1, 78, :_reduce_none,
215
+ 1, 78, :_reduce_none,
216
+ 1, 78, :_reduce_none,
217
+ 1, 78, :_reduce_none,
218
+ 1, 78, :_reduce_none,
219
+ 1, 78, :_reduce_none ]
220
+
221
+ racc_reduce_n = 109
222
+
223
+ racc_shift_n = 167
224
+
225
+ racc_action_table = [
226
+ -69, 130, -70, 23, 25, 153, 94, 29, 31, 142,
227
+ 143, 16, 17, 20, 22, 98, -69, 154, -70, 32,
228
+ -69, 107, -70, 145, 146, 78, -69, 91, -70, 75,
229
+ -70, 23, 25, 120, 88, 29, 31, 105, 106, 16,
230
+ 17, 20, 22, 81, 27, 23, 25, 32, 112, 29,
231
+ 31, 96, 80, 16, 17, 20, 22, 117, 27, 23,
232
+ 25, 32, 79, 29, 31, 78, 123, 16, 17, 20,
233
+ 22, 100, 27, 23, 25, 32, 125, 29, 31, 113,
234
+ 115, 16, 17, 20, 22, 126, 23, 25, 101, 32,
235
+ 29, 31, 91, 128, 16, 17, 20, 22, 129, 27,
236
+ 23, 25, 32, 101, 29, 31, 101, 75, 16, 17,
237
+ 20, 22, 77, 52, 23, 25, 32, 65, 29, 31,
238
+ 133, 78, 16, 17, 20, 22, 62, 23, 25, 136,
239
+ 32, 29, 31, 60, 44, 16, 17, 20, 22, 139,
240
+ 23, 25, 101, 32, 29, 31, 101, 100, 16, 17,
241
+ 20, 22, 100, 27, 23, 25, 32, 101, 29, 31,
242
+ 147, 148, 16, 17, 20, 22, 151, 23, 25, 152,
243
+ 32, 29, 31, 74, 42, 16, 17, 20, 22, 156,
244
+ 158, 92, 40, 32, 23, 25, 15, 68, 29, 31,
245
+ 163, 40, 16, 17, 20, 22, 165, 27, 23, 25,
246
+ 32, 166, 29, 31, nil, nil, 16, 17, 20, 22,
247
+ nil, 27, 23, 25, 32, nil, 29, 31, nil, nil,
248
+ 16, 17, 20, 22, nil, 23, 25, nil, 32, 29,
249
+ 31, nil, nil, 16, 17, 20, 22, nil, 23, 25,
250
+ nil, 32, 29, 31, nil, nil, 16, 17, 20, 22,
251
+ nil, 23, 25, nil, 32, 29, 31, nil, nil, 16,
252
+ 17, 20, 22, nil, 27, nil, nil, 32, 23, 25,
253
+ 120, nil, 29, 31, nil, nil, 16, 17, 20, 22,
254
+ nil, 27, 23, 25, 32, nil, 29, 31, nil, nil,
255
+ 16, 17, 20, 22, nil, 23, 25, 109, 32, 29,
256
+ 31, 74, nil, 16, 17, 20, 22, nil, 84, 25,
257
+ nil, 32, 29, 31, nil, 87, 16, 17, 20, 22,
258
+ 84, 25, nil, 109, 29, 31, nil, 87, 16, 17,
259
+ 20, 22, 84, 25, nil, nil, 29, 31, nil, 87,
260
+ 16, 17, 20, 22, 84, 25, nil, nil, 29, 31,
261
+ nil, 87, 16, 17, 20, 22, 84, 25, nil, nil,
262
+ 29, 31, nil, 87, 16, 17, 20, 22, 84, 25,
263
+ nil, nil, 29, 31, nil, 87, 16, 17, 20, 22,
264
+ 4, 6, 7, 8, 9, 10, 11, 12, 13, 1,
265
+ 2, 3, 84, 25, nil, nil, 29, 31, nil, 87,
266
+ 16, 17, 20, 22 ]
267
+
268
+ racc_action_check = [
269
+ 28, 112, 75, 71, 71, 143, 56, 71, 71, 134,
270
+ 134, 71, 71, 71, 71, 62, 28, 143, 75, 71,
271
+ 28, 73, 75, 136, 136, 51, 28, 50, 75, 28,
272
+ 75, 127, 127, 127, 45, 127, 127, 72, 72, 127,
273
+ 127, 127, 127, 42, 127, 3, 3, 127, 80, 3,
274
+ 3, 60, 41, 3, 3, 3, 3, 89, 3, 151,
275
+ 151, 3, 40, 151, 151, 36, 96, 151, 151, 151,
276
+ 151, 97, 151, 55, 55, 151, 98, 55, 55, 86,
277
+ 86, 55, 55, 55, 55, 100, 7, 7, 86, 55,
278
+ 7, 7, 102, 104, 7, 7, 7, 7, 105, 7,
279
+ 8, 8, 7, 108, 8, 8, 111, 70, 8, 8,
280
+ 8, 8, 33, 8, 9, 9, 8, 13, 9, 9,
281
+ 117, 121, 9, 9, 9, 9, 12, 10, 10, 126,
282
+ 9, 10, 10, 11, 6, 10, 10, 10, 10, 130,
283
+ 2, 2, 131, 10, 2, 2, 67, 135, 2, 2,
284
+ 2, 2, 66, 2, 122, 122, 2, 138, 122, 122,
285
+ 139, 140, 122, 122, 122, 122, 141, 52, 52, 142,
286
+ 122, 52, 52, 52, 5, 52, 52, 52, 52, 147,
287
+ 150, 52, 4, 52, 26, 26, 1, 26, 26, 26,
288
+ 156, 158, 26, 26, 26, 26, 162, 26, 68, 68,
289
+ 26, 163, 68, 68, nil, nil, 68, 68, 68, 68,
290
+ nil, 68, 59, 59, 68, nil, 59, 59, nil, nil,
291
+ 59, 59, 59, 59, nil, 154, 154, nil, 59, 154,
292
+ 154, nil, nil, 154, 154, 154, 154, nil, 94, 94,
293
+ nil, 154, 94, 94, nil, nil, 94, 94, 94, 94,
294
+ nil, 38, 38, nil, 94, 38, 38, nil, nil, 38,
295
+ 38, 38, 38, nil, 38, nil, nil, 38, 90, 90,
296
+ 90, nil, 90, 90, nil, nil, 90, 90, 90, 90,
297
+ nil, 90, 76, 76, 90, nil, 76, 76, nil, nil,
298
+ 76, 76, 76, 76, nil, 27, 27, 76, 76, 27,
299
+ 27, 27, nil, 27, 27, 27, 27, nil, 114, 114,
300
+ nil, 27, 114, 114, nil, 114, 114, 114, 114, 114,
301
+ 44, 44, nil, 114, 44, 44, nil, 44, 44, 44,
302
+ 44, 44, 74, 74, nil, nil, 74, 74, nil, 74,
303
+ 74, 74, 74, 74, 113, 113, nil, nil, 113, 113,
304
+ nil, 113, 113, 113, 113, 113, 129, 129, nil, nil,
305
+ 129, 129, nil, 129, 129, 129, 129, 129, 88, 88,
306
+ nil, nil, 88, 88, nil, 88, 88, 88, 88, 88,
307
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
308
+ 0, 0, 77, 77, nil, nil, 77, 77, nil, 77,
309
+ 77, 77, 77, 77 ]
310
+
311
+ racc_action_pointer = [
312
+ 378, 155, 126, 31, 167, 174, 116, 72, 86, 100,
313
+ 113, 119, 95, 86, nil, nil, nil, nil, nil, nil,
314
+ nil, nil, nil, nil, nil, nil, 170, 281, 0, nil,
315
+ nil, nil, nil, 92, nil, nil, 39, nil, 237, nil,
316
+ 46, 38, 43, nil, 306, 15, nil, nil, nil, nil,
317
+ 11, -1, 153, nil, nil, 59, -10, nil, nil, 198,
318
+ 22, nil, -17, nil, nil, nil, 126, 117, 184, nil,
319
+ 78, -11, 21, -7, 318, 2, 268, 378, nil, nil,
320
+ 33, nil, nil, nil, nil, nil, 59, nil, 354, 35,
321
+ 254, nil, nil, nil, 224, nil, 52, 45, 45, nil,
322
+ 54, nil, 76, nil, 65, 78, nil, nil, 74, nil,
323
+ nil, 77, -13, 330, 294, nil, nil, 105, nil, nil,
324
+ nil, 95, 140, nil, nil, nil, 96, 17, nil, 342,
325
+ 125, 113, nil, nil, -14, 121, -7, nil, 128, 143,
326
+ 146, 141, 154, -10, nil, nil, nil, 165, nil, nil,
327
+ 154, 45, nil, nil, 211, nil, 173, nil, 176, nil,
328
+ nil, nil, 168, 187, nil, nil, nil ]
329
+
330
+ racc_action_default = [
331
+ -109, -109, -109, -109, -14, -109, -20, -109, -109, -109,
332
+ -109, -109, -109, -109, -10, -95, -105, -106, -77, -44,
333
+ -107, -11, -108, -79, -43, -102, -109, -109, -60, -103,
334
+ -55, -104, -78, -68, -54, -71, -45, -12, -109, -1,
335
+ -109, -109, -109, -2, -109, -22, -51, -48, -50, -3,
336
+ -40, -41, -109, -46, -4, -86, -5, -88, -6, -90,
337
+ -109, -7, -95, -8, -9, -98, -100, -61, -59, -56,
338
+ -69, -109, -109, -109, -109, -75, -109, -109, -57, -15,
339
+ -109, 167, -73, -80, -82, -21, -24, -81, -109, -27,
340
+ -109, -83, -47, -89, -109, -91, -109, -100, -109, -99,
341
+ -101, -75, -58, -52, -109, -109, -64, -63, -65, -76,
342
+ -72, -67, -109, -109, -109, -26, -23, -109, -29, -49,
343
+ -84, -42, -87, -92, -94, -95, -109, -109, -62, -109,
344
+ -109, -25, -74, -28, -31, -100, -109, -53, -66, -109,
345
+ -109, -34, -109, -109, -93, -96, -97, -109, -18, -13,
346
+ -38, -109, -30, -33, -109, -32, -16, -19, -14, -35,
347
+ -36, -37, -109, -109, -39, -85, -17 ]
348
+
349
+ racc_goto_table = [
350
+ 39, 67, 70, 73, 38, 66, 69, 24, 37, 57,
351
+ 59, 36, 55, 67, 99, 90, 85, 157, 69, 108,
352
+ 83, 134, 111, 76, 49, 53, 141, 70, 73, 150,
353
+ 118, 89, 45, 155, 159, 149, 140, 21, 14, 19,
354
+ 119, 102, 64, 63, 61, 124, 70, 104, 58, 132,
355
+ 83, 56, 97, 83, 54, 93, 43, 5, 131, 95,
356
+ 116, nil, 76, nil, 83, 76, nil, 127, nil, 38,
357
+ nil, nil, nil, 103, 138, nil, 110, nil, nil, nil,
358
+ nil, nil, nil, 144, nil, nil, nil, nil, nil, 83,
359
+ 83, nil, nil, nil, 57, nil, nil, 122, nil, 121,
360
+ nil, nil, nil, nil, nil, 83, nil, nil, nil, nil,
361
+ nil, nil, nil, nil, nil, 135, nil, nil, nil, nil,
362
+ nil, nil, 93, nil, nil, nil, 70, 161, 38, 70,
363
+ 162, 160, 137, nil, nil, nil, nil, nil, nil, nil,
364
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
365
+ nil, nil, nil, nil, 164 ]
366
+
367
+ racc_goto_check = [
368
+ 2, 37, 37, 29, 36, 46, 28, 13, 13, 41,
369
+ 41, 31, 45, 37, 47, 32, 24, 23, 28, 25,
370
+ 44, 20, 25, 42, 4, 4, 21, 37, 29, 22,
371
+ 19, 18, 17, 26, 27, 16, 15, 12, 11, 33,
372
+ 34, 35, 10, 9, 8, 47, 37, 29, 7, 43,
373
+ 44, 6, 46, 44, 5, 41, 3, 1, 25, 41,
374
+ 24, nil, 42, nil, 44, 42, nil, 32, nil, 36,
375
+ nil, nil, nil, 13, 25, nil, 41, nil, nil, nil,
376
+ nil, nil, nil, 47, nil, nil, nil, nil, nil, 44,
377
+ 44, nil, nil, nil, 41, nil, nil, 45, nil, 31,
378
+ nil, nil, nil, nil, nil, 44, nil, nil, nil, nil,
379
+ nil, nil, nil, nil, nil, 46, nil, nil, nil, nil,
380
+ nil, nil, 41, nil, nil, nil, 37, 29, 36, 37,
381
+ 29, 28, 13, nil, nil, nil, nil, nil, nil, nil,
382
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
383
+ nil, nil, nil, nil, 2 ]
384
+
385
+ racc_goto_pointer = [
386
+ nil, 57, -4, 50, 17, 46, 42, 38, 33, 31,
387
+ 29, 37, 35, 5, nil, -94, -105, 26, -14, -59,
388
+ -97, -108, -112, -133, -28, -55, -110, -117, -20, -24,
389
+ nil, 9, -35, 37, -50, -27, 1, -25, nil, nil,
390
+ nil, 0, -5, -65, -24, 3, -10, -52 ]
391
+
392
+ racc_goto_default = [
393
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
394
+ nil, nil, nil, 48, 41, nil, nil, nil, nil, nil,
395
+ nil, nil, nil, nil, nil, 86, nil, nil, 30, 34,
396
+ 50, 51, nil, 46, 47, nil, 26, 28, 71, 72,
397
+ 33, 35, 114, 82, 18, nil, nil, nil ]
398
+
399
+ racc_token_table = {
400
+ false => 0,
401
+ Object.new => 1,
402
+ :DATETIME => 2,
403
+ :RECEIVED => 3,
404
+ :MADDRESS => 4,
405
+ :RETPATH => 5,
406
+ :KEYWORDS => 6,
407
+ :ENCRYPTED => 7,
408
+ :MIMEVERSION => 8,
409
+ :CTYPE => 9,
410
+ :CENCODING => 10,
411
+ :CDISPOSITION => 11,
412
+ :ADDRESS => 12,
413
+ :MAILBOX => 13,
414
+ :DIGIT => 14,
415
+ :ATOM => 15,
416
+ "," => 16,
417
+ ":" => 17,
418
+ :FROM => 18,
419
+ :BY => 19,
420
+ "@" => 20,
421
+ :DOMLIT => 21,
422
+ :VIA => 22,
423
+ :WITH => 23,
424
+ :ID => 24,
425
+ :FOR => 25,
426
+ ";" => 26,
427
+ "<" => 27,
428
+ ">" => 28,
429
+ "." => 29,
430
+ :QUOTED => 30,
431
+ :TOKEN => 31,
432
+ "/" => 32,
433
+ "=" => 33 }
434
+
435
+ racc_use_result_var = false
436
+
437
+ racc_nt_base = 34
438
+
439
+ Racc_arg = [
440
+ racc_action_table,
441
+ racc_action_check,
442
+ racc_action_default,
443
+ racc_action_pointer,
444
+ racc_goto_table,
445
+ racc_goto_check,
446
+ racc_goto_default,
447
+ racc_goto_pointer,
448
+ racc_nt_base,
449
+ racc_reduce_table,
450
+ racc_token_table,
451
+ racc_shift_n,
452
+ racc_reduce_n,
453
+ racc_use_result_var ]
454
+
455
+ Racc_token_to_s_table = [
456
+ '$end',
457
+ 'error',
458
+ 'DATETIME',
459
+ 'RECEIVED',
460
+ 'MADDRESS',
461
+ 'RETPATH',
462
+ 'KEYWORDS',
463
+ 'ENCRYPTED',
464
+ 'MIMEVERSION',
465
+ 'CTYPE',
466
+ 'CENCODING',
467
+ 'CDISPOSITION',
468
+ 'ADDRESS',
469
+ 'MAILBOX',
470
+ 'DIGIT',
471
+ 'ATOM',
472
+ '","',
473
+ '":"',
474
+ 'FROM',
475
+ 'BY',
476
+ '"@"',
477
+ 'DOMLIT',
478
+ 'VIA',
479
+ 'WITH',
480
+ 'ID',
481
+ 'FOR',
482
+ '";"',
483
+ '"<"',
484
+ '">"',
485
+ '"."',
486
+ 'QUOTED',
487
+ 'TOKEN',
488
+ '"/"',
489
+ '"="',
490
+ '$start',
491
+ 'content',
492
+ 'datetime',
493
+ 'received',
494
+ 'addrs_TOP',
495
+ 'retpath',
496
+ 'keys',
497
+ 'enc',
498
+ 'version',
499
+ 'ctype',
500
+ 'cencode',
501
+ 'cdisp',
502
+ 'addr_TOP',
503
+ 'mbox',
504
+ 'day',
505
+ 'hour',
506
+ 'zone',
507
+ 'from',
508
+ 'by',
509
+ 'via',
510
+ 'with',
511
+ 'id',
512
+ 'for',
513
+ 'received_datetime',
514
+ 'received_domain',
515
+ 'domain',
516
+ 'msgid',
517
+ 'received_addrspec',
518
+ 'routeaddr',
519
+ 'spec',
520
+ 'addrs',
521
+ 'group_bare',
522
+ 'commas',
523
+ 'group',
524
+ 'addr',
525
+ 'mboxes',
526
+ 'addr_phrase',
527
+ 'local_head',
528
+ 'routes',
529
+ 'at_domains',
530
+ 'local',
531
+ 'word',
532
+ 'dots',
533
+ 'domword',
534
+ 'atom',
535
+ 'phrase',
536
+ 'params',
537
+ 'opt_semicolon']
538
+
539
+ Racc_debug_parser = false
540
+
541
+ ##### racc system variables end #####
542
+
543
+ # reduce 0 omitted
544
+
545
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 16
546
+ def _reduce_1( val, _values)
547
+ val[1]
548
+ end
549
+ .,.,
550
+
551
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 17
552
+ def _reduce_2( val, _values)
553
+ val[1]
554
+ end
555
+ .,.,
556
+
557
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 18
558
+ def _reduce_3( val, _values)
559
+ val[1]
560
+ end
561
+ .,.,
562
+
563
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 19
564
+ def _reduce_4( val, _values)
565
+ val[1]
566
+ end
567
+ .,.,
568
+
569
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 20
570
+ def _reduce_5( val, _values)
571
+ val[1]
572
+ end
573
+ .,.,
574
+
575
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 21
576
+ def _reduce_6( val, _values)
577
+ val[1]
578
+ end
579
+ .,.,
580
+
581
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 22
582
+ def _reduce_7( val, _values)
583
+ val[1]
584
+ end
585
+ .,.,
586
+
587
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 23
588
+ def _reduce_8( val, _values)
589
+ val[1]
590
+ end
591
+ .,.,
592
+
593
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 24
594
+ def _reduce_9( val, _values)
595
+ val[1]
596
+ end
597
+ .,.,
598
+
599
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 25
600
+ def _reduce_10( val, _values)
601
+ val[1]
602
+ end
603
+ .,.,
604
+
605
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 26
606
+ def _reduce_11( val, _values)
607
+ val[1]
608
+ end
609
+ .,.,
610
+
611
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 27
612
+ def _reduce_12( val, _values)
613
+ val[1]
614
+ end
615
+ .,.,
616
+
617
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 36
618
+ def _reduce_13( val, _values)
619
+ t = Time.gm(val[3].to_i, val[2], val[1].to_i, 0, 0, 0)
620
+ (t + val[4] - val[5]).localtime
621
+ end
622
+ .,.,
623
+
624
+ # reduce 14 omitted
625
+
626
+ # reduce 15 omitted
627
+
628
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 45
629
+ def _reduce_16( val, _values)
630
+ (val[0].to_i * 60 * 60) +
631
+ (val[2].to_i * 60)
632
+ end
633
+ .,.,
634
+
635
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 51
636
+ def _reduce_17( val, _values)
637
+ (val[0].to_i * 60 * 60) +
638
+ (val[2].to_i * 60) +
639
+ (val[4].to_i)
640
+ end
641
+ .,.,
642
+
643
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 56
644
+ def _reduce_18( val, _values)
645
+ timezone_string_to_unixtime(val[0])
646
+ end
647
+ .,.,
648
+
649
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 61
650
+ def _reduce_19( val, _values)
651
+ val
652
+ end
653
+ .,.,
654
+
655
+ # reduce 20 omitted
656
+
657
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 67
658
+ def _reduce_21( val, _values)
659
+ val[1]
660
+ end
661
+ .,.,
662
+
663
+ # reduce 22 omitted
664
+
665
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 73
666
+ def _reduce_23( val, _values)
667
+ val[1]
668
+ end
669
+ .,.,
670
+
671
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 79
672
+ def _reduce_24( val, _values)
673
+ join_domain(val[0])
674
+ end
675
+ .,.,
676
+
677
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 83
678
+ def _reduce_25( val, _values)
679
+ join_domain(val[2])
680
+ end
681
+ .,.,
682
+
683
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 87
684
+ def _reduce_26( val, _values)
685
+ join_domain(val[0])
686
+ end
687
+ .,.,
688
+
689
+ # reduce 27 omitted
690
+
691
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 93
692
+ def _reduce_28( val, _values)
693
+ val[1]
694
+ end
695
+ .,.,
696
+
697
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 98
698
+ def _reduce_29( val, _values)
699
+ []
700
+ end
701
+ .,.,
702
+
703
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 103
704
+ def _reduce_30( val, _values)
705
+ val[0].push val[2]
706
+ val[0]
707
+ end
708
+ .,.,
709
+
710
+ # reduce 31 omitted
711
+
712
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 109
713
+ def _reduce_32( val, _values)
714
+ val[1]
715
+ end
716
+ .,.,
717
+
718
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 113
719
+ def _reduce_33( val, _values)
720
+ val[1]
721
+ end
722
+ .,.,
723
+
724
+ # reduce 34 omitted
725
+
726
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 119
727
+ def _reduce_35( val, _values)
728
+ val[1]
729
+ end
730
+ .,.,
731
+
732
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 125
733
+ def _reduce_36( val, _values)
734
+ val[0].spec
735
+ end
736
+ .,.,
737
+
738
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 129
739
+ def _reduce_37( val, _values)
740
+ val[0].spec
741
+ end
742
+ .,.,
743
+
744
+ # reduce 38 omitted
745
+
746
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 136
747
+ def _reduce_39( val, _values)
748
+ val[1]
749
+ end
750
+ .,.,
751
+
752
+ # reduce 40 omitted
753
+
754
+ # reduce 41 omitted
755
+
756
+ # reduce 42 omitted
757
+
758
+ # reduce 43 omitted
759
+
760
+ # reduce 44 omitted
761
+
762
+ # reduce 45 omitted
763
+
764
+ # reduce 46 omitted
765
+
766
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 146
767
+ def _reduce_47( val, _values)
768
+ [ Address.new(nil, nil) ]
769
+ end
770
+ .,.,
771
+
772
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 152
773
+ def _reduce_48( val, _values)
774
+ val
775
+ end
776
+ .,.,
777
+
778
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 157
779
+ def _reduce_49( val, _values)
780
+ val[0].push val[2]
781
+ val[0]
782
+ end
783
+ .,.,
784
+
785
+ # reduce 50 omitted
786
+
787
+ # reduce 51 omitted
788
+
789
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 165
790
+ def _reduce_52( val, _values)
791
+ val
792
+ end
793
+ .,.,
794
+
795
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 170
796
+ def _reduce_53( val, _values)
797
+ val[0].push val[2]
798
+ val[0]
799
+ end
800
+ .,.,
801
+
802
+ # reduce 54 omitted
803
+
804
+ # reduce 55 omitted
805
+
806
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 178
807
+ def _reduce_56( val, _values)
808
+ val[1].phrase = Decoder.decode(val[0])
809
+ val[1]
810
+ end
811
+ .,.,
812
+
813
+ # reduce 57 omitted
814
+
815
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 185
816
+ def _reduce_58( val, _values)
817
+ AddressGroup.new(val[0], val[2])
818
+ end
819
+ .,.,
820
+
821
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 185
822
+ def _reduce_59( val, _values)
823
+ AddressGroup.new(val[0], [])
824
+ end
825
+ .,.,
826
+
827
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 188
828
+ def _reduce_60( val, _values)
829
+ val[0].join('.')
830
+ end
831
+ .,.,
832
+
833
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 189
834
+ def _reduce_61( val, _values)
835
+ val[0] << ' ' << val[1].join('.')
836
+ end
837
+ .,.,
838
+
839
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 196
840
+ def _reduce_62( val, _values)
841
+ val[2].routes.replace val[1]
842
+ val[2]
843
+ end
844
+ .,.,
845
+
846
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 200
847
+ def _reduce_63( val, _values)
848
+ val[1]
849
+ end
850
+ .,.,
851
+
852
+ # reduce 64 omitted
853
+
854
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 203
855
+ def _reduce_65( val, _values)
856
+ [ val[1].join('.') ]
857
+ end
858
+ .,.,
859
+
860
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 204
861
+ def _reduce_66( val, _values)
862
+ val[0].push val[3].join('.'); val[0]
863
+ end
864
+ .,.,
865
+
866
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 206
867
+ def _reduce_67( val, _values)
868
+ Address.new( val[0], val[2] )
869
+ end
870
+ .,.,
871
+
872
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 207
873
+ def _reduce_68( val, _values)
874
+ Address.new( val[0], nil )
875
+ end
876
+ .,.,
877
+
878
+ # reduce 69 omitted
879
+
880
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 210
881
+ def _reduce_70( val, _values)
882
+ val[0].push ''; val[0]
883
+ end
884
+ .,.,
885
+
886
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 213
887
+ def _reduce_71( val, _values)
888
+ val
889
+ end
890
+ .,.,
891
+
892
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 222
893
+ def _reduce_72( val, _values)
894
+ val[1].times do
895
+ val[0].push ''
896
+ end
897
+ val[0].push val[2]
898
+ val[0]
899
+ end
900
+ .,.,
901
+
902
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 224
903
+ def _reduce_73( val, _values)
904
+ val
905
+ end
906
+ .,.,
907
+
908
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 233
909
+ def _reduce_74( val, _values)
910
+ val[1].times do
911
+ val[0].push ''
912
+ end
913
+ val[0].push val[2]
914
+ val[0]
915
+ end
916
+ .,.,
917
+
918
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 234
919
+ def _reduce_75( val, _values)
920
+ 0
921
+ end
922
+ .,.,
923
+
924
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 235
925
+ def _reduce_76( val, _values)
926
+ val[0] + 1
927
+ end
928
+ .,.,
929
+
930
+ # reduce 77 omitted
931
+
932
+ # reduce 78 omitted
933
+
934
+ # reduce 79 omitted
935
+
936
+ # reduce 80 omitted
937
+
938
+ # reduce 81 omitted
939
+
940
+ # reduce 82 omitted
941
+
942
+ # reduce 83 omitted
943
+
944
+ # reduce 84 omitted
945
+
946
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 253
947
+ def _reduce_85( val, _values)
948
+ val[1] = val[1].spec
949
+ val.join('')
950
+ end
951
+ .,.,
952
+
953
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 254
954
+ def _reduce_86( val, _values)
955
+ val
956
+ end
957
+ .,.,
958
+
959
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 255
960
+ def _reduce_87( val, _values)
961
+ val[0].push val[2]; val[0]
962
+ end
963
+ .,.,
964
+
965
+ # reduce 88 omitted
966
+
967
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 258
968
+ def _reduce_89( val, _values)
969
+ val[0] << ' ' << val[1]
970
+ end
971
+ .,.,
972
+
973
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 265
974
+ def _reduce_90( val, _values)
975
+ val.push nil
976
+ val
977
+ end
978
+ .,.,
979
+
980
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 269
981
+ def _reduce_91( val, _values)
982
+ val
983
+ end
984
+ .,.,
985
+
986
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 274
987
+ def _reduce_92( val, _values)
988
+ [ val[0].to_i, val[2].to_i ]
989
+ end
990
+ .,.,
991
+
992
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 279
993
+ def _reduce_93( val, _values)
994
+ [ val[0].downcase, val[2].downcase, decode_params(val[3]) ]
995
+ end
996
+ .,.,
997
+
998
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 283
999
+ def _reduce_94( val, _values)
1000
+ [ val[0].downcase, nil, decode_params(val[1]) ]
1001
+ end
1002
+ .,.,
1003
+
1004
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 288
1005
+ def _reduce_95( val, _values)
1006
+ {}
1007
+ end
1008
+ .,.,
1009
+
1010
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 293
1011
+ def _reduce_96( val, _values)
1012
+ val[0][ val[2].downcase ] = ('"' + val[4].to_s + '"')
1013
+ val[0]
1014
+ end
1015
+ .,.,
1016
+
1017
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 298
1018
+ def _reduce_97( val, _values)
1019
+ val[0][ val[2].downcase ] = val[4]
1020
+ val[0]
1021
+ end
1022
+ .,.,
1023
+
1024
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 303
1025
+ def _reduce_98( val, _values)
1026
+ val[0].downcase
1027
+ end
1028
+ .,.,
1029
+
1030
+ module_eval <<'.,.,', 'lib/tmail/parser.y', 308
1031
+ def _reduce_99( val, _values)
1032
+ [ val[0].downcase, decode_params(val[1]) ]
1033
+ end
1034
+ .,.,
1035
+
1036
+ # reduce 100 omitted
1037
+
1038
+ # reduce 101 omitted
1039
+
1040
+ # reduce 102 omitted
1041
+
1042
+ # reduce 103 omitted
1043
+
1044
+ # reduce 104 omitted
1045
+
1046
+ # reduce 105 omitted
1047
+
1048
+ # reduce 106 omitted
1049
+
1050
+ # reduce 107 omitted
1051
+
1052
+ # reduce 108 omitted
1053
+
1054
+ def _reduce_none( val, _values)
1055
+ val[0]
1056
+ end
1057
+
1058
+ end # class Parser
1059
+
1060
+ end # module TMail