diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-01-19 03:13:34 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-01-19 03:13:34 +0000 |
commit | 982d9092952923ef0f20cabad7cf79c192e8494f (patch) | |
tree | fe191a281d73a8e6172a6739e38e3fee52cfec49 /actionmailer | |
parent | abfab89fd824a4fab9d1415efaec87ee2f48aa50 (diff) | |
download | rails-982d9092952923ef0f20cabad7cf79c192e8494f.tar.gz rails-982d9092952923ef0f20cabad7cf79c192e8494f.tar.bz2 rails-982d9092952923ef0f20cabad7cf79c192e8494f.zip |
Update tmail to r208 versioned as 1.2.2
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8667 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionmailer')
-rw-r--r-- | actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/Makefile | 19 | ||||
-rwxr-xr-x | actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/facade.rb | 552 | ||||
-rwxr-xr-x | actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/info.rb | 35 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/parser.y | 381 | ||||
-rwxr-xr-x | actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/tmail.rb | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail.rb) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/address.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/address.rb) | 53 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/attachments.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/attachments.rb) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/base64.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/base64.rb) | 0 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/compat.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/compat.rb) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/config.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/config.rb) | 0 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/core_extensions.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/core_extensions.rb) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/encode.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/encode.rb) | 21 | ||||
-rw-r--r--[-rwxr-xr-x] | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/header.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/header.rb) | 6 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/index.rb | 8 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/interface.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/interface.rb) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/loader.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/loader.rb) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/mail.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/mail.rb) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/mailbox.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/mailbox.rb) | 0 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/main.rb | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/mbox.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/mbox.rb) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/net.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/net.rb) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/obsolete.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/obsolete.rb) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/parser.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/parser.rb) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/port.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/port.rb) | 0 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/quoting.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/quoting.rb) | 0 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/require_arch.rb | 56 | ||||
-rw-r--r--[-rwxr-xr-x] | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/scanner.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/scanner.rb) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/scanner_r.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/scanner_r.rb) | 18 | ||||
-rw-r--r--[-rwxr-xr-x] | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/stringio.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/stringio.rb) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/utils.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/utils.rb) | 2 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/version.rb (renamed from actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/version.rb) | 2 |
32 files changed, 151 insertions, 1008 deletions
diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/Makefile b/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/Makefile deleted file mode 100644 index 346353b83f..0000000000 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# -# lib/tmail/Makefile -# - -debug: - rm -f parser.rb - make parser.rb DEBUG=true - -parser.rb: parser.y - if [ "$(DEBUG)" = true ]; then \ - racc -v -g -o$@ parser.y ;\ - else \ - racc -E -o$@ parser.y ;\ - fi - -clean: - rm -f parser.rb parser.output - -distclean: clean diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/facade.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/facade.rb deleted file mode 100755 index 1ecd64bff8..0000000000 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/facade.rb +++ /dev/null @@ -1,552 +0,0 @@ -# -# facade.rb -# -#-- -# Copyright (c) 1998-2003 Minero Aoki <aamine@loveruby.net> -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Note: Originally licensed under LGPL v2+. Using MIT license for Rails -# with permission of Minero Aoki. -#++ - -require 'tmail/utils' - - -module TMail - - class Mail - - def header_string( name, default = nil ) - h = @header[name.downcase] or return default - h.to_s - end - - ### - ### attributes - ### - - include TextUtils - - def set_string_array_attr( key, strs ) - strs.flatten! - if strs.empty? - @header.delete key.downcase - else - store key, strs.join(', ') - end - strs - end - private :set_string_array_attr - - def set_string_attr( key, str ) - if str - store key, str - else - @header.delete key.downcase - end - str - end - private :set_string_attr - - def set_addrfield( name, arg ) - if arg - h = HeaderField.internal_new(name, @config) - h.addrs.replace [arg].flatten - @header[name] = h - else - @header.delete name - end - arg - end - private :set_addrfield - - def addrs2specs( addrs ) - return nil unless addrs - list = addrs.map {|addr| - if addr.address_group? - then addr.map {|a| a.spec } - else addr.spec - end - }.flatten - return nil if list.empty? - list - end - private :addrs2specs - - - # - # date time - # - - def date( default = nil ) - if h = @header['date'] - h.date - else - default - end - end - - def date=( time ) - if time - store 'Date', time2str(time) - else - @header.delete 'date' - end - time - end - - def strftime( fmt, default = nil ) - if t = date - t.strftime(fmt) - else - default - end - end - - - # - # destination - # - - def to_addrs( default = nil ) - if h = @header['to'] - h.addrs - else - default - end - end - - def cc_addrs( default = nil ) - if h = @header['cc'] - h.addrs - else - default - end - end - - def bcc_addrs( default = nil ) - if h = @header['bcc'] - h.addrs - else - default - end - end - - def to_addrs=( arg ) - set_addrfield 'to', arg - end - - def cc_addrs=( arg ) - set_addrfield 'cc', arg - end - - def bcc_addrs=( arg ) - set_addrfield 'bcc', arg - end - - def to( default = nil ) - addrs2specs(to_addrs(nil)) || default - end - - def cc( default = nil ) - addrs2specs(cc_addrs(nil)) || default - end - - def bcc( default = nil ) - addrs2specs(bcc_addrs(nil)) || default - end - - def to=( *strs ) - set_string_array_attr 'To', strs - end - - def cc=( *strs ) - set_string_array_attr 'Cc', strs - end - - def bcc=( *strs ) - set_string_array_attr 'Bcc', strs - end - - - # - # originator - # - - def from_addrs( default = nil ) - if h = @header['from'] - h.addrs - else - default - end - end - - def from_addrs=( arg ) - set_addrfield 'from', arg - end - - def from( default = nil ) - addrs2specs(from_addrs(nil)) || default - end - - def from=( *strs ) - set_string_array_attr 'From', strs - end - - def friendly_from( default = nil ) - h = @header['from'] - a, = h.addrs - return default unless a - return a.phrase if a.phrase - return h.comments.join(' ') unless h.comments.empty? - a.spec - end - - - def reply_to_addrs( default = nil ) - if h = @header['reply-to'] - h.addrs - else - default - end - end - - def reply_to_addrs=( arg ) - set_addrfield 'reply-to', arg - end - - def reply_to( default = nil ) - addrs2specs(reply_to_addrs(nil)) || default - end - - def reply_to=( *strs ) - set_string_array_attr 'Reply-To', strs - end - - - def sender_addr( default = nil ) - f = @header['sender'] or return default - f.addr or return default - end - - def sender_addr=( addr ) - if addr - h = HeaderField.internal_new('sender', @config) - h.addr = addr - @header['sender'] = h - else - @header.delete 'sender' - end - addr - end - - def sender( default ) - f = @header['sender'] or return default - a = f.addr or return default - a.spec - end - - def sender=( str ) - set_string_attr 'Sender', str - end - - - # - # subject - # - - def subject( default = nil ) - if h = @header['subject'] - h.body - else - default - end - end - alias quoted_subject subject - - def subject=( str ) - set_string_attr 'Subject', str - end - - - # - # identity & threading - # - - def message_id( default = nil ) - if h = @header['message-id'] - h.id || default - else - default - end - end - - def message_id=( str ) - set_string_attr 'Message-Id', str - end - - def in_reply_to( default = nil ) - if h = @header['in-reply-to'] - h.ids - else - default - end - end - - def in_reply_to=( *idstrs ) - set_string_array_attr 'In-Reply-To', idstrs - end - - def references( default = nil ) - if h = @header['references'] - h.refs - else - default - end - end - - def references=( *strs ) - set_string_array_attr 'References', strs - end - - - # - # MIME headers - # - - def mime_version( default = nil ) - if h = @header['mime-version'] - h.version || default - else - default - end - end - - def mime_version=( m, opt = nil ) - if opt - if h = @header['mime-version'] - h.major = m - h.minor = opt - else - store 'Mime-Version', "#{m}.#{opt}" - end - else - store 'Mime-Version', m - end - m - end - - - def content_type( default = nil ) - if h = @header['content-type'] - h.content_type || default - else - default - end - end - - def main_type( default = nil ) - if h = @header['content-type'] - h.main_type || default - else - default - end - end - - def sub_type( default = nil ) - if h = @header['content-type'] - h.sub_type || default - else - default - end - end - - def set_content_type( str, sub = nil, param = nil ) - if sub - main, sub = str, sub - else - main, sub = str.split(%r</>, 2) - raise ArgumentError, "sub type missing: #{str.inspect}" unless sub - end - if h = @header['content-type'] - h.main_type = main - h.sub_type = sub - h.params.clear - else - store 'Content-Type', "#{main}/#{sub}" - end - @header['content-type'].params.replace param if param - - str - end - - alias content_type= set_content_type - - def type_param( name, default = nil ) - if h = @header['content-type'] - h[name] || default - else - default - end - end - - def charset( default = nil ) - if h = @header['content-type'] - h['charset'] or default - else - default - end - end - - def charset=( str ) - if str - if h = @header[ 'content-type' ] - h['charset'] = str - else - store 'Content-Type', "text/plain; charset=#{str}" - end - end - str - end - - - def transfer_encoding( default = nil ) - if h = @header['content-transfer-encoding'] - h.encoding || default - else - default - end - end - - def transfer_encoding=( str ) - set_string_attr 'Content-Transfer-Encoding', str - end - - alias encoding transfer_encoding - alias encoding= transfer_encoding= - alias content_transfer_encoding transfer_encoding - alias content_transfer_encoding= transfer_encoding= - - - def disposition( default = nil ) - if h = @header['content-disposition'] - h.disposition || default - else - default - end - end - - alias content_disposition disposition - - def set_disposition( str, params = nil ) - if h = @header['content-disposition'] - h.disposition = str - h.params.clear - else - store('Content-Disposition', str) - h = @header['content-disposition'] - end - h.params.replace params if params - end - - alias disposition= set_disposition - alias set_content_disposition set_disposition - alias content_disposition= set_disposition - - def disposition_param( name, default = nil ) - if h = @header['content-disposition'] - h[name] || default - else - default - end - end - - ### - ### utils - ### - - def create_reply - mail = TMail::Mail.parse('') - mail.subject = 'Re: ' + subject('').sub(/\A(?:\[[^\]]+\])?(?:\s*Re:)*\s*/i, '') - mail.to_addrs = reply_addresses([]) - mail.in_reply_to = [message_id(nil)].compact - mail.references = references([]) + [message_id(nil)].compact - mail.mime_version = '1.0' - mail - end - - - def base64_encode - store 'Content-Transfer-Encoding', 'Base64' - self.body = Base64.folding_encode(self.body) - end - - def base64_decode - if /base64/i === self.transfer_encoding('') - store 'Content-Transfer-Encoding', '8bit' - self.body = Base64.decode(self.body, @config.strict_base64decode?) - end - end - - - def destinations( default = nil ) - ret = [] - %w( to cc bcc ).each do |nm| - if h = @header[nm] - h.addrs.each {|i| ret.push i.address } - end - end - ret.empty? ? default : ret - end - - def each_destination( &block ) - destinations([]).each do |i| - if Address === i - yield i - else - i.each(&block) - end - end - end - - alias each_dest each_destination - - - def reply_addresses( default = nil ) - reply_to_addrs(nil) or from_addrs(nil) or default - end - - def error_reply_addresses( default = nil ) - if s = sender(nil) - [s] - else - from_addrs(default) - end - end - - - def multipart? - main_type('').downcase == 'multipart' - end - - end # class Mail - -end # module TMail diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/info.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/info.rb deleted file mode 100755 index 5c115d5876..0000000000 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/info.rb +++ /dev/null @@ -1,35 +0,0 @@ -# -# info.rb -# -#-- -# Copyright (c) 1998-2003 Minero Aoki <aamine@loveruby.net> -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Note: Originally licensed under LGPL v2+. Using MIT license for Rails -# with permission of Minero Aoki. -#++ - -module TMail - - Version = '0.10.7' - Copyright = 'Copyright (c) 1998-2002 Minero Aoki' - -end diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/parser.y b/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/parser.y deleted file mode 100644 index 77a1457794..0000000000 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/parser.y +++ /dev/null @@ -1,381 +0,0 @@ -# -# parser.y -# -# Copyright (c) 1998-2007 Minero Aoki -# -# This program is free software. -# You can distribute/modify this program under the terms of -# the GNU Lesser General Public License version 2.1. -# - -class TMail::Parser - - options no_result_var - -rule - - content : DATETIME datetime { val[1] } - | RECEIVED received { val[1] } - | MADDRESS addrs_TOP { val[1] } - | RETPATH retpath { val[1] } - | KEYWORDS keys { val[1] } - | ENCRYPTED enc { val[1] } - | MIMEVERSION version { val[1] } - | CTYPE ctype { val[1] } - | CENCODING cencode { val[1] } - | CDISPOSITION cdisp { val[1] } - | ADDRESS addr_TOP { val[1] } - | MAILBOX mbox { val[1] } - - datetime : day DIGIT ATOM DIGIT hour zone - # 0 1 2 3 4 5 - # date month year - { - t = Time.gm(val[3].to_i, val[2], val[1].to_i, 0, 0, 0) - (t + val[4] - val[5]).localtime - } - - day : /* none */ - | ATOM ',' - - hour : DIGIT ':' DIGIT - { - (val[0].to_i * 60 * 60) + - (val[2].to_i * 60) - } - | DIGIT ':' DIGIT ':' DIGIT - { - (val[0].to_i * 60 * 60) + - (val[2].to_i * 60) + - (val[4].to_i) - } - - zone : ATOM - { - timezone_string_to_unixtime(val[0]) - } - - received : from by via with id for received_datetime - { - val - } - - from : /* none */ - | FROM received_domain - { - val[1] - } - - by : /* none */ - | BY received_domain - { - val[1] - } - - received_domain - : domain - { - join_domain(val[0]) - } - | domain '@' domain - { - join_domain(val[2]) - } - | domain DOMLIT - { - join_domain(val[0]) - } - - via : /* none */ - | VIA ATOM - { - val[1] - } - - with : /* none */ - { - [] - } - | with WITH ATOM - { - val[0].push val[2] - val[0] - } - - id : /* none */ - | ID msgid - { - val[1] - } - | ID ATOM - { - val[1] - } - - for : /* none */ - | FOR received_addrspec - { - val[1] - } - - received_addrspec - : routeaddr - { - val[0].spec - } - | spec - { - val[0].spec - } - - received_datetime - : /* none */ - | ';' datetime - { - val[1] - } - - addrs_TOP : addrs - | group_bare - | addrs commas group_bare - - addr_TOP : mbox - | group - | group_bare - - retpath : addrs_TOP - | '<' '>' { [ Address.new(nil, nil) ] } - - addrs : addr - { - val - } - | addrs commas addr - { - val[0].push val[2] - val[0] - } - - addr : mbox - | group - - mboxes : mbox - { - val - } - | mboxes commas mbox - { - val[0].push val[2] - val[0] - } - - mbox : spec - | routeaddr - | addr_phrase routeaddr - { - val[1].phrase = Decoder.decode(val[0]) - val[1] - } - - group : group_bare ';' - - group_bare: addr_phrase ':' mboxes - { - AddressGroup.new(val[0], val[2]) - } - | addr_phrase ':' { AddressGroup.new(val[0], []) } - - addr_phrase - : local_head { val[0].join('.') } - | addr_phrase local_head { val[0] << ' ' << val[1].join('.') } - - routeaddr : '<' routes spec '>' - { - val[2].routes.replace val[1] - val[2] - } - | '<' spec '>' - { - val[1] - } - - routes : at_domains ':' - - at_domains: '@' domain { [ val[1].join('.') ] } - | at_domains ',' '@' domain { val[0].push val[3].join('.'); val[0] } - - spec : local '@' domain { Address.new( val[0], val[2] ) } - | local { Address.new( val[0], nil ) } - - local: local_head - | local_head '.' { val[0].push ''; val[0] } - - local_head: word - { val } - | local_head dots word - { - val[1].times do - val[0].push '' - end - val[0].push val[2] - val[0] - } - - domain : domword - { val } - | domain dots domword - { - val[1].times do - val[0].push '' - end - val[0].push val[2] - val[0] - } - - dots : '.' { 0 } - | '.' '.' { 1 } - - word : atom - | QUOTED - | DIGIT - - domword : atom - | DOMLIT - | DIGIT - - commas : ',' - | commas ',' - - msgid : '<' spec '>' - { - val[1] = val[1].spec - val.join('') - } - - keys : phrase { val } - | keys ',' phrase { val[0].push val[2]; val[0] } - - phrase : word - | phrase word { val[0] << ' ' << val[1] } - - enc : word - { - val.push nil - val - } - | word word - { - val - } - - version : DIGIT '.' DIGIT - { - [ val[0].to_i, val[2].to_i ] - } - - ctype : TOKEN '/' TOKEN params opt_semicolon - { - [ val[0].downcase, val[2].downcase, decode_params(val[3]) ] - } - | TOKEN params opt_semicolon - { - [ val[0].downcase, nil, decode_params(val[1]) ] - } - - params : /* none */ - { - {} - } - | params ';' TOKEN '=' QUOTED - { - val[0][ val[2].downcase ] = ('"' + val[4].to_s + '"') - val[0] - } - | params ';' TOKEN '=' TOKEN - { - val[0][ val[2].downcase ] = val[4] - val[0] - } - - cencode : TOKEN - { - val[0].downcase - } - - cdisp : TOKEN params opt_semicolon - { - [ val[0].downcase, decode_params(val[1]) ] - } - - opt_semicolon - : - | ';' - - atom : ATOM - | FROM - | BY - | VIA - | WITH - | ID - | FOR - -end - - ----- header -# -# parser.rb -# -# Copyright (c) 1998-2007 Minero Aoki -# -# This program is free software. -# You can distribute/modify this program under the terms of -# the GNU Lesser General Public License version 2.1. -# - -require 'tmail/scanner' -require 'tmail/utils' - ----- inner - - include TextUtils - - def self.parse( ident, str, cmt = nil ) - new.parse(ident, str, cmt) - end - - MAILP_DEBUG = false - - def initialize - self.debug = MAILP_DEBUG - end - - def debug=( flag ) - @yydebug = flag && Racc_debug_parser - @scanner_debug = flag - end - - def debug - @yydebug - end - - def parse( ident, str, comments = nil ) - @scanner = Scanner.new(str, ident, comments) - @scanner.debug = @scanner_debug - @first = [ident, ident] - result = yyparse(self, :parse_in) - comments.map! {|c| to_kcode(c) } if comments - result - end - - private - - def parse_in( &block ) - yield @first - @scanner.scan(&block) - end - - def on_error( t, val, vstack ) - raise SyntaxError, "parse error on token #{racc_token2str t}" - end - diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/tmail.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/tmail.rb deleted file mode 100755 index 57ed3cc581..0000000000 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/tmail.rb +++ /dev/null @@ -1 +0,0 @@ -require 'tmail' diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail.rb index 7de185019b..7de185019b 100755..100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail.rb diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/address.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/address.rb index 224ed7090e..b601941809 100755..100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/address.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/address.rb @@ -41,7 +41,41 @@ module TMail include TextUtils def Address.parse( str ) - Parser.parse :ADDRESS, str + Parser.parse :ADDRESS, special_quote_address(str) + end + + # Takes a string which is an address and adds quotation marks to special + # edge case methods that the parser just barfs on. + # + # Right now just handles two edge cases: + # + # Full stop as the last character of the display name: + # Mikel A. <mikel@me.com> + # Returns: + # "Mikel A." <mikel@me.com> + # + # Unquoted @ symbol in the display name: + # mikel@me.com <mikel@me.com> + # Returns: + # "mikel@me.com" <mikel@me.com> + # + # Any other address not matching these patterns just gets returned as is. + def Address.special_quote_address(str) + case + # This handles the missing "" in an older version of Apple Mail.app + # around the display name when the display name contains a '@' + # like 'mikel@me.com <mikel@me.com>' + # Just quotes it to: '"mikel@me.com" <mikel@me.com>' + when str =~ /\A([^"].+@.+[^"])\s(<.*?>)\Z/ + return "\"#{$1}\" #{$2}" + # This handles cases where 'Mikel A. <mikel@me.com>' which is a trailing + # full stop before the address section. Just quotes it to + # '"Mikel A. <mikel@me.com>" + when str =~ /\A(.*?\.)\s(<.*?>)\Z/ + return "\"#{$1}\" #{$2}" + else + str + end end def address_group? @@ -54,8 +88,16 @@ module TMail raise SyntaxError, 'empty word in domain' if s.empty? end end + + # This is to catch an unquoted "@" symbol in the local part of the + # address. Handles addresses like <"@"@me.com> and makes sure they + # stay like <"@"@me.com> (previously were becomming <@@me.com>) + if local && (local.join == '@' || local.join =~ /\A[^"].*?@.*?[^"]\Z/) + @local = "\"#{local.join}\"" + else + @local = local + end - @local = local @domain = domain @name = nil @routes = [] @@ -80,7 +122,12 @@ module TMail def local return nil unless @local return '""' if @local.size == 1 and @local[0].empty? - @local.map {|i| quote_atom(i) }.join('.') + # Check to see if it is an array before trying to map it + if @local.respond_to?(:map) + @local.map {|i| quote_atom(i) }.join('.') + else + quote_atom(@local) + end end def domain diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/attachments.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/attachments.rb index a8b8017cf9..a8b8017cf9 100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/attachments.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/attachments.rb diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/base64.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/base64.rb index e99b6b0ba2..e99b6b0ba2 100755..100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/base64.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/base64.rb diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/compat.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/compat.rb index 9d2aa83798..9d2aa83798 100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/compat.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/compat.rb diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/config.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/config.rb index 4b253d2b2a..4b253d2b2a 100755..100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/config.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/config.rb diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/core_extensions.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/core_extensions.rb index cc24e97778..cc24e97778 100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/core_extensions.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/core_extensions.rb diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/encode.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/encode.rb index ba3a5fffcf..8ca3db2936 100755..100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/encode.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/encode.rb @@ -35,6 +35,11 @@ require 'tmail/utils' module TMail + + class << self + attr_accessor :KCODE + end + self.KCODE = 'NONE' module StrategyInterface @@ -90,8 +95,8 @@ module TMail } def self.decode( str, encoding = nil ) - encoding ||= (OUTPUT_ENCODING[$KCODE] || 'j') - opt = '-m' + encoding + encoding ||= (OUTPUT_ENCODING[TMail.KCODE] || 'j') + opt = '-mS' + encoding str.gsub(ENCODED_WORDS) {|s| NKF.nkf(opt, s) } end @@ -193,8 +198,9 @@ module TMail def initialize( dest = nil, encoding = nil, eol = "\r\n", limit = nil ) @f = StrategyInterface.create_dest(dest) - @opt = OPTIONS[$KCODE] + @opt = OPTIONS[TMail.KCODE] @eol = eol + @folded = false @preserve_quotes = true reset end @@ -367,11 +373,16 @@ module TMail end def concat_A_S( types, strs ) + if RUBY_VERSION < '1.9' + a = ?a; s = ?s + else + a = 'a'.ord; s = 's'.ord + end i = 0 types.each_byte do |t| case t - when ?a then add_text strs[i] - when ?s then add_lwsp strs[i] + when a then add_text strs[i] + when s then add_lwsp strs[i] else raise "TMail FATAL: unknown flag: #{t.chr}" end diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/header.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/header.rb index 31ad6fd612..e397342534 100755..100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/header.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/header.rb @@ -214,7 +214,11 @@ module TMail def comments ensure_parsed - @comments + if @comments[0] + [Decoder.decode(@comments[0])] + else + @comments + end end private diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/index.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/index.rb new file mode 100644 index 0000000000..258e3df115 --- /dev/null +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/index.rb @@ -0,0 +1,8 @@ +# This is here for Rolls. +# Rolls uses this instead of lib/tmail.rb. + +require 'tmail/version' +require 'tmail/mail' +require 'tmail/mailbox' +require 'tmail/core_extensions' + diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/interface.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/interface.rb index 991c1b829e..991c1b829e 100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/interface.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/interface.rb diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/loader.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/loader.rb index 7907315401..7907315401 100755..100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/loader.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/loader.rb diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/mail.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/mail.rb index 252c91846f..252c91846f 100755..100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/mail.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/mail.rb diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/mailbox.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/mailbox.rb index 8dd51059e7..8dd51059e7 100755..100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/mailbox.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/mailbox.rb diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/main.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/main.rb new file mode 100644 index 0000000000..7de185019b --- /dev/null +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/main.rb @@ -0,0 +1,4 @@ +require 'tmail/version' +require 'tmail/mail' +require 'tmail/mailbox' +require 'tmail/core_extensions' diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/mbox.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/mbox.rb index 7907315401..7907315401 100755..100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/mbox.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/mbox.rb diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/net.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/net.rb index df524975d6..df524975d6 100755..100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/net.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/net.rb diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/obsolete.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/obsolete.rb index b871510b82..b871510b82 100755..100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/obsolete.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/obsolete.rb diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/parser.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/parser.rb index 5deb0ff655..5deb0ff655 100755..100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/parser.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/parser.rb diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/port.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/port.rb index 445f0e632b..445f0e632b 100755..100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/port.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/port.rb diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/quoting.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/quoting.rb index cb9f4288f1..cb9f4288f1 100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/quoting.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/quoting.rb diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/require_arch.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/require_arch.rb new file mode 100644 index 0000000000..a0fcd5768e --- /dev/null +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/require_arch.rb @@ -0,0 +1,56 @@ +require 'rbconfig' + +# Attempts to require anative extension. +# Falls back to pure-ruby version, if it fails. +# +# This uses Config::CONFIG['arch'] from rbconfig. + +def require_arch(fname) + arch = Config::CONFIG['arch'] + begin + path = File.join("tmail", arch, fname) + require path + rescue LoadError => e + # try pre-built Windows binaries + if arch =~ /mswin/ + require File.join("tmail", 'mswin32', fname) + else + raise e + end + end +end + + +# def require_arch(fname) +# dext = Config::CONFIG['DLEXT'] +# begin +# if File.extname(fname) == dext +# path = fname +# else +# path = File.join("tmail","#{fname}.#{dext}") +# end +# require path +# rescue LoadError => e +# begin +# arch = Config::CONFIG['arch'] +# path = File.join("tmail", arch, "#{fname}.#{dext}") +# require path +# rescue LoadError +# case path +# when /i686/ +# path.sub!('i686', 'i586') +# when /i586/ +# path.sub!('i586', 'i486') +# when /i486/ +# path.sub!('i486', 'i386') +# else +# begin +# require fname + '.rb' +# rescue LoadError +# raise e +# end +# end +# retry +# end +# end +# end diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/scanner.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/scanner.rb index 15cc3c4977..3e851e33d3 100755..100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/scanner.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/scanner.rb @@ -29,6 +29,7 @@ # with permission of Minero Aoki. #++ +#require 'tmail/require_arch' require 'tmail/utils' require 'tmail/config' diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/scanner_r.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/scanner_r.rb index cc10a0c7db..f40326c0b9 100755..100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/scanner_r.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/scanner_r.rb @@ -105,7 +105,7 @@ module TMail @received = (scantype == :RECEIVED) @is_mime_header = MIME_HEADERS[scantype] - atom, token, @quoted_re, @domlit_re, @comment_re = PATTERN_TABLE[$KCODE] + atom, token, @quoted_re, @domlit_re, @comment_re = PATTERN_TABLE[TMail.KCODE] @word_re = (MIME_HEADERS[scantype] ? token : atom) end @@ -145,34 +145,34 @@ module TMail if s = readstr(@word_re) if @is_mime_header - yield :TOKEN, s + yield [:TOKEN, s] else # atom if /\A\d+\z/ === s - yield :DIGIT, s + yield [:DIGIT, s] elsif @received - yield RECV_TOKEN[s.downcase] || :ATOM, s + yield [RECV_TOKEN[s.downcase] || :ATOM, s] else - yield :ATOM, s + yield [:ATOM, s] end end elsif skip(/\A"/) - yield :QUOTED, scan_quoted_word() + yield [:QUOTED, scan_quoted_word()] elsif skip(/\A\[/) - yield :DOMLIT, scan_domain_literal() + yield [:DOMLIT, scan_domain_literal()] elsif skip(/\A\(/) @comments.push scan_comment() else c = readchar() - yield c, c + yield [c, c] end end - yield false, '$' + yield [false, '$'] end def scan_quoted_word diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/stringio.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/stringio.rb index 3817850f63..3817850f63 100755..100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/stringio.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/stringio.rb diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/utils.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/utils.rb index 9e6af8ee02..0c307bd927 100755..100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/utils.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/utils.rb @@ -239,7 +239,7 @@ module TMail } def to_kcode( str ) - flag = NKF_FLAGS[$KCODE] or return str + flag = NKF_FLAGS[TMail.KCODE] or return str NKF.nkf(flag, str) end diff --git a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/version.rb b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/version.rb index c618a729e4..ccd37dc8ee 100644 --- a/actionmailer/lib/action_mailer/vendor/tmail-1.2.1/tmail/version.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail-1.2.2/tmail/version.rb @@ -31,7 +31,7 @@ module TMail #:nodoc: module VERSION #:nodoc: MAJOR = 1 MINOR = 2 - TINY = 0 + TINY = 2 STRING = [MAJOR, MINOR, TINY].join('.') end |