Skip to content

Commit

Permalink
Bundle tmail 1.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed May 20, 2008
1 parent b433093 commit 762295e
Show file tree
Hide file tree
Showing 28 changed files with 38 additions and 13 deletions.
4 changes: 2 additions & 2 deletions actionmailer/lib/action_mailer/vendor.rb
Expand Up @@ -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
Expand Down
Expand Up @@ -339,22 +339,36 @@ def encode_value( str )
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
Expand Down Expand Up @@ -453,7 +467,13 @@ def extract_J( chunksize, str )
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 )
Expand Down
Expand Up @@ -591,12 +591,17 @@ def message_id( default = nil )
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
Expand Down
Expand Up @@ -408,8 +408,8 @@ def parse_header( f )
when /\AFrom (\S+)/
unixfrom = $1

when /^charset=.*/
when /^charset=.*/

else
raise SyntaxError, "wrong mail header: '#{line.inspect}'"
end
Expand Down
Expand Up @@ -118,7 +118,7 @@ module TextUtils
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
Expand Down
Expand Up @@ -32,7 +32,7 @@ module TMail
module VERSION
MAJOR = 1
MINOR = 2
TINY = 2
TINY = 3

STRING = [MAJOR, MINOR, TINY].join('.')
end
Expand Down

0 comments on commit 762295e

Please sign in to comment.