mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Bundle tmail 1.2.3
This commit is contained in:
parent
b43309328a
commit
762295e0ae
28 changed files with 38 additions and 13 deletions
|
@ -2,9 +2,9 @@
|
|||
require 'rubygems'
|
||||
|
||||
begin
|
||||
gem 'tmail', '~> 1.2.2'
|
||||
gem 'tmail', '~> 1.2.3'
|
||||
rescue Gem::LoadError
|
||||
$:.unshift "#{File.dirname(__FILE__)}/vendor/tmail-1.2.2"
|
||||
$:.unshift "#{File.dirname(__FILE__)}/vendor/tmail-1.2.3"
|
||||
end
|
||||
|
||||
begin
|
||||
|
|
|
@ -339,22 +339,36 @@ module TMail
|
|||
def scanadd( str, force = false )
|
||||
types = ''
|
||||
strs = []
|
||||
|
||||
if str.respond_to?(:encoding)
|
||||
enc = str.encoding
|
||||
str.force_encoding(Encoding::ASCII_8BIT)
|
||||
end
|
||||
until str.empty?
|
||||
if m = /\A[^\e\t\r\n ]+/.match(str)
|
||||
types << (force ? 'j' : 'a')
|
||||
strs.push m[0]
|
||||
|
||||
if str.respond_to?(:encoding)
|
||||
strs.push m[0].force_encoding(enc)
|
||||
else
|
||||
strs.push m[0]
|
||||
end
|
||||
elsif m = /\A[\t\r\n ]+/.match(str)
|
||||
types << 's'
|
||||
strs.push m[0]
|
||||
if str.respond_to?(:encoding)
|
||||
strs.push m[0].force_encoding(enc)
|
||||
else
|
||||
strs.push m[0]
|
||||
end
|
||||
|
||||
elsif m = /\A\e../.match(str)
|
||||
esc = m[0]
|
||||
str = m.post_match
|
||||
if esc != "\e(B" and m = /\A[^\e]+/.match(str)
|
||||
types << 'j'
|
||||
strs.push m[0]
|
||||
if str.respond_to?(:encoding)
|
||||
strs.push m[0].force_encoding(enc)
|
||||
else
|
||||
strs.push m[0]
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
|
@ -453,7 +467,13 @@ module TMail
|
|||
size = max_bytes(chunksize, str.size) - 6
|
||||
size = (size % 2 == 0) ? (size) : (size - 1)
|
||||
return nil if size <= 0
|
||||
"\e$B#{str.slice!(0, size)}\e(B"
|
||||
if str.respond_to?(:encoding)
|
||||
enc = str.encoding
|
||||
str.force_encoding(Encoding::ASCII_8BIT)
|
||||
"\e$B#{str.slice!(0, size)}\e(B".force_encoding(enc)
|
||||
else
|
||||
"\e$B#{str.slice!(0, size)}\e(B"
|
||||
end
|
||||
end
|
||||
|
||||
def extract_A( chunksize, str )
|
|
@ -591,12 +591,17 @@ module TMail
|
|||
end
|
||||
|
||||
# Destructively sets the message ID of the mail object instance to the passed in string
|
||||
#
|
||||
# Invalid message IDs are ignored (silently, unless configured otherwise) and result in
|
||||
# a nil message ID. Left and right angle brackets are required.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# mail = TMail::Mail.new
|
||||
# mail.message_id = "<348F04F142D69C21-291E56D292BC@xxxx.net>"
|
||||
# mail.message_id #=> "<348F04F142D69C21-291E56D292BC@xxxx.net>"
|
||||
# mail.message_id = "this_is_my_badly_formatted_message_id"
|
||||
# mail.message_id #=> "this_is_my_badly_formatted_message_id"
|
||||
# mail.message_id #=> nil
|
||||
def message_id=( str )
|
||||
set_string_attr 'Message-Id', str
|
||||
end
|
|
@ -408,8 +408,8 @@ module TMail
|
|||
when /\AFrom (\S+)/
|
||||
unixfrom = $1
|
||||
|
||||
when /^charset=.*/
|
||||
|
||||
when /^charset=.*/
|
||||
|
||||
else
|
||||
raise SyntaxError, "wrong mail header: '#{line.inspect}'"
|
||||
end
|
|
@ -118,7 +118,7 @@ module TMail
|
|||
ATOM_UNSAFE = /[#{Regexp.quote aspecial}#{control}#{lwsp}]/n
|
||||
PHRASE_UNSAFE = /[#{Regexp.quote aspecial}#{control}]/n
|
||||
TOKEN_UNSAFE = /[#{Regexp.quote tspecial}#{control}#{lwsp}]/n
|
||||
|
||||
|
||||
# Returns true if the string supplied is free from characters not allowed as an ATOM
|
||||
def atom_safe?( str )
|
||||
not ATOM_UNSAFE === str
|
|
@ -32,7 +32,7 @@ module TMail
|
|||
module VERSION
|
||||
MAJOR = 1
|
||||
MINOR = 2
|
||||
TINY = 2
|
||||
TINY = 3
|
||||
|
||||
STRING = [MAJOR, MINOR, TINY].join('.')
|
||||
end
|
Loading…
Reference in a new issue