actionmailer 2.3.5 → 2.3.6

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.
Files changed (81) hide show
  1. data/CHANGELOG +8 -0
  2. data/MIT-LICENSE +1 -1
  3. data/Rakefile +1 -1
  4. data/lib/action_mailer.rb +1 -1
  5. data/lib/action_mailer/base.rb +2 -2
  6. data/lib/action_mailer/quoting.rb +1 -0
  7. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail.rb +1 -0
  8. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/Makefile +18 -0
  9. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/address.rb +4 -38
  10. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/attachments.rb +65 -0
  11. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/base64.rb +0 -0
  12. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/compat.rb +0 -0
  13. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/config.rb +0 -0
  14. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/core_extensions.rb +0 -0
  15. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/encode.rb +9 -0
  16. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/header.rb +4 -2
  17. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/index.rb +0 -0
  18. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/interface.rb +33 -1
  19. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/loader.rb +0 -0
  20. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/mail.rb +1 -1
  21. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/mailbox.rb +3 -2
  22. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/main.rb +0 -0
  23. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/mbox.rb +0 -0
  24. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/net.rb +3 -1
  25. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/obsolete.rb +0 -0
  26. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/parser.rb +1060 -0
  27. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/parser.y +416 -0
  28. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/port.rb +0 -0
  29. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/quoting.rb +47 -1
  30. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/require_arch.rb +0 -0
  31. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/scanner.rb +0 -0
  32. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/scanner_r.rb +2 -1
  33. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/stringio.rb +0 -0
  34. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/utils.rb +50 -25
  35. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/COPYING +504 -0
  36. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/README +12 -0
  37. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet.rb +67 -0
  38. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/big5freq.rb +927 -0
  39. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/big5prober.rb +42 -0
  40. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/chardistribution.rb +238 -0
  41. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/charsetgroupprober.rb +112 -0
  42. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/charsetprober.rb +75 -0
  43. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/codingstatemachine.rb +64 -0
  44. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/constants.rb +42 -0
  45. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/escprober.rb +89 -0
  46. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/escsm.rb +244 -0
  47. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/eucjpprober.rb +88 -0
  48. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euckrfreq.rb +596 -0
  49. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euckrprober.rb +42 -0
  50. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euctwfreq.rb +430 -0
  51. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euctwprober.rb +42 -0
  52. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312freq.rb +474 -0
  53. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312prober.rb +42 -0
  54. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/hebrewprober.rb +289 -0
  55. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/jisfreq.rb +570 -0
  56. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/jpcntx.rb +229 -0
  57. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langbulgarianmodel.rb +229 -0
  58. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langcyrillicmodel.rb +330 -0
  59. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langgreekmodel.rb +227 -0
  60. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langhebrewmodel.rb +202 -0
  61. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langhungarianmodel.rb +226 -0
  62. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langthaimodel.rb +201 -0
  63. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/latin1prober.rb +147 -0
  64. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/mbcharsetprober.rb +89 -0
  65. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/mbcsgroupprober.rb +45 -0
  66. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/mbcssm.rb +542 -0
  67. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sbcharsetprober.rb +124 -0
  68. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sbcsgroupprober.rb +56 -0
  69. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sjisprober.rb +88 -0
  70. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/universaldetector.rb +168 -0
  71. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/utf8prober.rb +87 -0
  72. data/lib/action_mailer/vendor/{tmail-1.2.3 → tmail-1.2.7}/tmail/version.rb +1 -1
  73. data/lib/action_mailer/vendor/tmail.rb +2 -2
  74. data/lib/action_mailer/version.rb +1 -1
  75. data/test/abstract_unit.rb +1 -1
  76. data/test/fixtures/helpers/example_helper.rb +1 -1
  77. data/test/mail_service_test.rb +66 -2
  78. data/test/quoting_test.rb +10 -4
  79. metadata +87 -37
  80. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/attachments.rb +0 -46
  81. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/parser.rb +0 -1478
data/CHANGELOG CHANGED
@@ -1,15 +1,23 @@
1
+ *2.3.6 (May 23, 2010)*
2
+
3
+ * Upgrade TMail from 1.2.3 to 1.2.7. [Mikel Lindsaar]
4
+
5
+
1
6
  *2.3.5 (November 25, 2009)*
2
7
 
3
8
  * Minor Bug Fixes and deprecation warnings
4
9
 
10
+
5
11
  *2.3.4 (September 4, 2009)*
6
12
 
7
13
  * Minor bug fixes.
8
14
 
15
+
9
16
  *2.3.3 (July 12, 2009)*
10
17
 
11
18
  * No changes, just a version bump.
12
19
 
20
+
13
21
  *2.3.2 [Final] (March 15, 2009)*
14
22
 
15
23
  * Fixed that ActionMailer should send correctly formatted Return-Path in MAIL FROM for SMTP #1842 [Matt Jones]
@@ -1,4 +1,4 @@
1
- Copyright (c) 2004-2009 David Heinemeier Hansson
1
+ Copyright (c) 2004-2010 David Heinemeier Hansson
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/Rakefile CHANGED
@@ -54,7 +54,7 @@ spec = Gem::Specification.new do |s|
54
54
  s.rubyforge_project = "actionmailer"
55
55
  s.homepage = "http://www.rubyonrails.org"
56
56
 
57
- s.add_dependency('actionpack', '= 2.3.5' + PKG_BUILD)
57
+ s.add_dependency('actionpack', '= 2.3.6' + PKG_BUILD)
58
58
 
59
59
  s.has_rdoc = true
60
60
  s.requirements << 'none'
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2004-2009 David Heinemeier Hansson
2
+ # Copyright (c) 2004-2010 David Heinemeier Hansson
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -593,7 +593,7 @@ module ActionMailer #:nodoc:
593
593
  end
594
594
 
595
595
  def template_path
596
- "#{template_root}/#{mailer_name}"
596
+ File.join(template_root, mailer_name)
597
597
  end
598
598
 
599
599
  def initialize_template_class(assigns)
@@ -675,7 +675,7 @@ module ActionMailer #:nodoc:
675
675
  def perform_delivery_smtp(mail)
676
676
  destinations = mail.destinations
677
677
  mail.ready_to_send
678
- sender = (mail['return-path'] && mail['return-path'].spec) || mail['from']
678
+ sender = (mail['return-path'] && mail['return-path'].spec) || Array(mail.from).first
679
679
 
680
680
  smtp = Net::SMTP.new(smtp_settings[:address], smtp_settings[:port])
681
681
  smtp.enable_starttls_auto if smtp_settings[:enable_starttls_auto] && smtp.respond_to?(:enable_starttls_auto)
@@ -1,3 +1,4 @@
1
+ # encoding: us-ascii
1
2
  module ActionMailer
2
3
  module Quoting #:nodoc:
3
4
  # Convert the given text into quoted printable format, with an instruction
@@ -3,3 +3,4 @@ require 'tmail/mail'
3
3
  require 'tmail/mailbox'
4
4
  require 'tmail/core_extensions'
5
5
  require 'tmail/net'
6
+ require 'tmail/vendor/rchardet-1.3/lib/rchardet'
@@ -0,0 +1,18 @@
1
+ # lib/tmail/Makefile
2
+ #
3
+
4
+ debug:
5
+ rm -f parser.rb
6
+ make parser.rb DEBUG=true
7
+
8
+ parser.rb: parser.y
9
+ if [ "$(DEBUG)" = true ]; then \
10
+ racc -v -g -o$@ parser.y ;\
11
+ else \
12
+ racc -E -o$@ parser.y ;\
13
+ fi
14
+
15
+ clean:
16
+ rm -f parser.rb parser.output
17
+
18
+ distclean: clean
@@ -46,7 +46,7 @@ module TMail
46
46
  #
47
47
  # Just pass the email address in as a string to Address.parse:
48
48
  #
49
- # email = TMail::Address.parse('Mikel Lindsaar <mikel@lindsaar.net>)
49
+ # email = TMail::Address.parse('Mikel Lindsaar <mikel@lindsaar.net>')
50
50
  # #=> #<TMail::Address mikel@lindsaar.net>
51
51
  # email.address
52
52
  # #=> "mikel@lindsaar.net"
@@ -63,7 +63,7 @@ module TMail
63
63
  # Address.parse and catch any SyntaxError:
64
64
  #
65
65
  # begin
66
- # TMail::Mail.parse("mikel 2@@@@@ me .com")
66
+ # TMail::Address.parse("mikel 2@@@@@ me .com")
67
67
  # rescue TMail::SyntaxError
68
68
  # puts("Invalid Email Address Detected")
69
69
  # else
@@ -81,41 +81,7 @@ module TMail
81
81
  #
82
82
  # Raises a TMail::SyntaxError on invalid email format
83
83
  def Address.parse( str )
84
- Parser.parse :ADDRESS, special_quote_address(str)
85
- end
86
-
87
- def Address.special_quote_address(str) #:nodoc:
88
- # Takes a string which is an address and adds quotation marks to special
89
- # edge case methods that the RACC parser can not handle.
90
- #
91
- # Right now just handles two edge cases:
92
- #
93
- # Full stop as the last character of the display name:
94
- # Mikel L. <mikel@me.com>
95
- # Returns:
96
- # "Mikel L." <mikel@me.com>
97
- #
98
- # Unquoted @ symbol in the display name:
99
- # mikel@me.com <mikel@me.com>
100
- # Returns:
101
- # "mikel@me.com" <mikel@me.com>
102
- #
103
- # Any other address not matching these patterns just gets returned as is.
104
- case
105
- # This handles the missing "" in an older version of Apple Mail.app
106
- # around the display name when the display name contains a '@'
107
- # like 'mikel@me.com <mikel@me.com>'
108
- # Just quotes it to: '"mikel@me.com" <mikel@me.com>'
109
- when str =~ /\A([^"].+@.+[^"])\s(<.*?>)\Z/
110
- return "\"#{$1}\" #{$2}"
111
- # This handles cases where 'Mikel A. <mikel@me.com>' which is a trailing
112
- # full stop before the address section. Just quotes it to
113
- # '"Mikel A. <mikel@me.com>"
114
- when str =~ /\A(.*?\.)\s(<.*?>)\Z/
115
- return "\"#{$1}\" #{$2}"
116
- else
117
- str
118
- end
84
+ Parser.parse :ADDRESS, str
119
85
  end
120
86
 
121
87
  def address_group? #:nodoc:
@@ -412,7 +378,7 @@ module TMail
412
378
  if first
413
379
  first = false
414
380
  else
415
- strategy.meta ','
381
+ strategy.puts_meta ','
416
382
  end
417
383
  strategy.space
418
384
  mbox.accept strategy
@@ -0,0 +1,65 @@
1
+ =begin rdoc
2
+
3
+ = Attachment handling file
4
+
5
+ =end
6
+
7
+ require 'kconv'
8
+ require 'stringio'
9
+
10
+ module TMail
11
+ class Attachment < StringIO
12
+ attr_accessor :original_filename, :content_type
13
+ alias quoted_filename original_filename
14
+ end
15
+
16
+ class Mail
17
+ def has_attachments?
18
+ attachment?(self) || multipart? && parts.any? { |part| attachment?(part) }
19
+ end
20
+
21
+ # Returns true if this part's content main type is text, else returns false.
22
+ # By main type is meant "text/plain" is text. "text/html" is text
23
+ def text_content_type?
24
+ self.header['content-type'] && (self.header['content-type'].main_type == 'text')
25
+ end
26
+
27
+ def inline_attachment?(part)
28
+ part['content-id'] || (part['content-disposition'] && part['content-disposition'].disposition == 'inline' && !part.text_content_type?)
29
+ end
30
+
31
+ def attachment?(part)
32
+ part.disposition_is_attachment? || (!part.content_type.nil? && !part.text_content_type?) unless part.multipart?
33
+ end
34
+
35
+ def attachments
36
+ if multipart?
37
+ parts.collect { |part| attachment(part) }.flatten.compact
38
+ elsif attachment?(self)
39
+ [attachment(self)]
40
+ end
41
+ end
42
+
43
+ private
44
+
45
+ def attachment(part)
46
+ if part.multipart?
47
+ part.attachments
48
+ elsif attachment?(part)
49
+ content = part.body # unquoted automatically by TMail#body
50
+ file_name = (part['content-location'] && part['content-location'].body) ||
51
+ part.sub_header('content-type', 'name') ||
52
+ part.sub_header('content-disposition', 'filename') ||
53
+ 'noname'
54
+
55
+ return if content.blank?
56
+
57
+ attachment = TMail::Attachment.new(content)
58
+ attachment.original_filename = file_name.strip unless file_name.blank?
59
+ attachment.content_type = part.content_type
60
+ attachment
61
+ end
62
+ end
63
+
64
+ end
65
+ end
@@ -113,6 +113,7 @@ module TMail
113
113
 
114
114
  encoded = '=\?(?:iso-2022-jp|euc-jp|shift_jis)\?[QB]\?[a-z0-9+/=]+\?='
115
115
  ENCODED_WORDS = /#{encoded}(?:\s+#{encoded})*/i
116
+ SPACER = "\t"
116
117
 
117
118
  OUTPUT_ENCODING = {
118
119
  'EUC' => 'e',
@@ -165,6 +166,10 @@ module TMail
165
166
  @f << str
166
167
  end
167
168
 
169
+ def puts_meta( str )
170
+ @f << str
171
+ end
172
+
168
173
  def text( str )
169
174
  @f << decode(str)
170
175
  end
@@ -301,6 +306,10 @@ module TMail
301
306
  add_text str
302
307
  end
303
308
 
309
+ def puts_meta( str )
310
+ add_text str + @eol + SPACER
311
+ end
312
+
304
313
  def text( str )
305
314
  scanadd normalize_encoding(str)
306
315
  end
@@ -243,6 +243,8 @@ module TMail
243
243
 
244
244
  def do_parse
245
245
  quote_boundary
246
+ quote_unquoted_name
247
+ quote_unquoted_bencode
246
248
  obj = Parser.parse(self.class::PARSE_TYPE, @body, @comments)
247
249
  set obj if obj
248
250
  end
@@ -314,7 +316,7 @@ module TMail
314
316
  if first
315
317
  first = false
316
318
  else
317
- strategy.meta ','
319
+ strategy.puts_meta ','
318
320
  strategy.space
319
321
  end
320
322
  a.accept strategy
@@ -817,7 +819,7 @@ module TMail
817
819
  if v
818
820
  strategy.meta ';'
819
821
  strategy.space
820
- strategy.kv_pair k, v
822
+ strategy.kv_pair k, unquote(v)
821
823
  end
822
824
  end
823
825
  end
@@ -595,6 +595,12 @@ module TMail
595
595
  # Invalid message IDs are ignored (silently, unless configured otherwise) and result in
596
596
  # a nil message ID. Left and right angle brackets are required.
597
597
  #
598
+ # Be warned however, that calling mail.ready_to_send will overwrite whatever value you
599
+ # have in this field with an automatically generated unique value.
600
+ #
601
+ # If you really want to set your own message ID and know what you are doing per the
602
+ # various RFCs, you can do so with the enforced_message_id= command
603
+ #
598
604
  # Example:
599
605
  #
600
606
  # mail = TMail::Mail.new
@@ -606,6 +612,22 @@ module TMail
606
612
  set_string_attr 'Message-Id', str
607
613
  end
608
614
 
615
+ # Destructively sets the message ID of the mail object instance to the passed in string
616
+ # and also guarantees that calling #ready_to_send will not destroy what you set as the
617
+ # message_id
618
+ #
619
+ # Example:
620
+ #
621
+ # mail = TMail::Mail.new
622
+ # mail.message_id = "<348F04F142D69C21-291E56D292BC@xxxx.net>"
623
+ # mail.message_id #=> "<348F04F142D69C21-291E56D292BC@xxxx.net>"
624
+ # mail.ready_to_send
625
+ # mail.message_id #=> "<348F04F142D69C21-291E56D292BC@xxxx.net>"
626
+ def enforced_message_id=( str )
627
+ @message_id_enforced = true
628
+ self.message_id = ( str )
629
+ end
630
+
609
631
  # Returns the "In-Reply-To:" field contents as an array of this mail instance if it exists
610
632
  #
611
633
  # If the in_reply_to field does not exist, returns nil by default or you can pass in as
@@ -843,7 +865,17 @@ module TMail
843
865
  if h = @header['content-type']
844
866
  h['charset'] or default
845
867
  else
846
- default
868
+ mime_version_charset || default
869
+ end
870
+ end
871
+
872
+ # some weird emails come with the charset specified in the mime-version header:
873
+ #
874
+ # #<TMail::MimeVersionHeader "1.0\n charset=\"gb2312\"">
875
+ #
876
+ def mime_version_charset
877
+ if header['mime-version'].inspect =~ /charset=('|\\")?([^\\"']+)/
878
+ $2
847
879
  end
848
880
  end
849
881
 
@@ -547,7 +547,7 @@ module TMail
547
547
  end
548
548
 
549
549
  def read_multipart( src )
550
- bound = @header['content-type'].params['boundary']
550
+ bound = @header['content-type'].params['boundary'] || ::TMail.new_boundary
551
551
  is_sep = /\A--#{Regexp.quote bound}(?:--)?[ \t]*(?:\n|\r\n|\r)/
552
552
  lastbound = "--#{bound}--"
553
553
 
@@ -364,9 +364,10 @@ module TMail
364
364
  end
365
365
 
366
366
  def fromline2time( line )
367
- m = /\AFrom \S+ \w+ (\w+) (\d+) (\d+):(\d+):(\d+) (\d+)/.match(line) \
368
- or return nil
367
+ m = /\AFrom \S+ \w+ (\w+) (\d+) (\d+):(\d+):(\d+) (\d+)/.match(line) or return nil
369
368
  Time.local(m[6].to_i, m[1], m[2].to_i, m[3].to_i, m[4].to_i, m[5].to_i)
369
+ rescue
370
+ nil
370
371
  end
371
372
 
372
373
  end # UNIXMbox
@@ -78,7 +78,9 @@ module TMail
78
78
  end
79
79
 
80
80
  def add_message_id( fqdn = nil )
81
- self.message_id = ::TMail::new_message_id(fqdn)
81
+ unless @message_id_enforced
82
+ self.message_id = ::TMail::new_message_id(fqdn)
83
+ end
82
84
  end
83
85
 
84
86
  def add_date
@@ -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