aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.lock64
-rw-r--r--lib/mail_handler/backends/mail_extensions.rb67
3 files changed, 33 insertions, 100 deletions
diff --git a/Gemfile b/Gemfile
index 016353cb1..bf9767142 100644
--- a/Gemfile
+++ b/Gemfile
@@ -7,7 +7,7 @@ if File.exist? "/etc/debian_version" and File.open("/etc/debian_version").read.s
end
source 'https://rubygems.org'
-gem 'rails', '3.1.11'
+gem 'rails', '3.1.12'
gem 'pg'
gem 'fast_gettext', '>= 0.6.0'
diff --git a/Gemfile.lock b/Gemfile.lock
index cf91b2d02..6c190836f 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -18,12 +18,12 @@ GIT
GEM
remote: https://rubygems.org/
specs:
- actionmailer (3.1.11)
- actionpack (= 3.1.11)
- mail (~> 2.3.3)
- actionpack (3.1.11)
- activemodel (= 3.1.11)
- activesupport (= 3.1.11)
+ actionmailer (3.1.12)
+ actionpack (= 3.1.12)
+ mail (~> 2.4.4)
+ actionpack (3.1.12)
+ activemodel (= 3.1.12)
+ activesupport (= 3.1.12)
builder (~> 3.0.0)
erubis (~> 2.7.0)
i18n (~> 0.6)
@@ -32,19 +32,19 @@ GEM
rack-mount (~> 0.8.2)
rack-test (~> 0.6.1)
sprockets (~> 2.0.4)
- activemodel (3.1.11)
- activesupport (= 3.1.11)
+ activemodel (3.1.12)
+ activesupport (= 3.1.12)
builder (~> 3.0.0)
i18n (~> 0.6)
- activerecord (3.1.11)
- activemodel (= 3.1.11)
- activesupport (= 3.1.11)
+ activerecord (3.1.12)
+ activemodel (= 3.1.12)
+ activesupport (= 3.1.12)
arel (~> 2.2.3)
tzinfo (~> 0.3.29)
- activeresource (3.1.11)
- activemodel (= 3.1.11)
- activesupport (= 3.1.11)
- activesupport (3.1.11)
+ activeresource (3.1.12)
+ activemodel (= 3.1.12)
+ activesupport (= 3.1.12)
+ activesupport (3.1.12)
multi_json (~> 1.0)
annotate (2.5.0)
rake
@@ -96,14 +96,14 @@ GEM
haml (3.1.7)
highline (1.6.15)
hike (1.2.1)
- i18n (0.6.2)
- json (1.5.5)
+ i18n (0.6.4)
+ json (1.7.7)
levenshtein (0.2.2)
linecache (0.46)
rbx-require-relative (> 0.0.4)
locale (2.0.8)
mahoro (0.3)
- mail (2.3.3)
+ mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
@@ -119,7 +119,7 @@ GEM
thin
memcache-client (1.8.5)
mime-types (1.21)
- multi_json (1.6.1)
+ multi_json (1.7.1)
net-http-local (0.1.2)
net-purge (0.1.0)
net-scp (1.0.4)
@@ -145,17 +145,17 @@ GEM
rack
rack-test (0.6.2)
rack (>= 1.0)
- rails (3.1.11)
- actionmailer (= 3.1.11)
- actionpack (= 3.1.11)
- activerecord (= 3.1.11)
- activeresource (= 3.1.11)
- activesupport (= 3.1.11)
+ rails (3.1.12)
+ actionmailer (= 3.1.12)
+ actionpack (= 3.1.12)
+ activerecord (= 3.1.12)
+ activeresource (= 3.1.12)
+ activesupport (= 3.1.12)
bundler (~> 1.0)
- railties (= 3.1.11)
- railties (3.1.11)
- actionpack (= 3.1.11)
- activesupport (= 3.1.11)
+ railties (= 3.1.12)
+ railties (3.1.12)
+ actionpack (= 3.1.12)
+ activesupport (= 3.1.12)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
@@ -218,11 +218,11 @@ GEM
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
thor (0.14.6)
- tilt (1.3.3)
+ tilt (1.3.6)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
- tzinfo (0.3.35)
+ tzinfo (0.3.37)
vpim (0.695)
webrat (0.7.3)
nokogiri (>= 1.2.0)
@@ -262,7 +262,7 @@ DEPENDENCIES
newrelic_rpm
pg
rack
- rails (= 3.1.11)
+ rails (= 3.1.12)
rake (= 0.9.2.2)
rdoc
recaptcha (~> 0.3.1)
diff --git a/lib/mail_handler/backends/mail_extensions.rb b/lib/mail_handler/backends/mail_extensions.rb
index 611b44c4c..d25012e39 100644
--- a/lib/mail_handler/backends/mail_extensions.rb
+++ b/lib/mail_handler/backends/mail_extensions.rb
@@ -46,28 +46,6 @@ module Mail
self
end
-
- # HACK: Backported from Mail 2.5 for Ruby 1.8 support
- # Can be removed when we no longer support Ruby 1.8
- def to_yaml(opts = {})
- hash = {}
- hash['headers'] = {}
- header.fields.each do |field|
- hash['headers'][field.name] = field.value
- end
- hash['delivery_handler'] = delivery_handler.to_s if delivery_handler
- hash['transport_encoding'] = transport_encoding.to_s
- special_variables = [:@header, :@delivery_handler, :@transport_encoding]
- if multipart?
- hash['multipart_body'] = []
- body.parts.map { |part| hash['multipart_body'] << part.to_yaml }
- special_variables.push(:@body, :@text_part, :@html_part)
- end
- (instance_variables.map(&:to_sym) - special_variables).each do |var|
- hash[var.to_s] = instance_variable_get(var)
- end
- hash.to_yaml(opts)
- end
end
# A patched version of the parameter hash that handles nil values without throwing
@@ -124,49 +102,4 @@ module Mail
end
end
end
-
- # HACK: Backport encoding fixes for Ruby 1.9 from Mail 2.5
- # Can be removed when Rails relies on Mail > 2.5
- class Ruby19
- def Ruby19.b_value_decode(str)
- match = str.match(/\=\?(.+)?\?[Bb]\?(.+)?\?\=/m)
- if match
- encoding = match[1]
- str = Ruby19.decode_base64(match[2])
- str.force_encoding(fix_encoding(encoding))
- end
- decoded = str.encode("utf-8", :invalid => :replace, :replace => "")
- decoded.valid_encoding? ? decoded : decoded.encode("utf-16le", :invalid => :replace, :replace => "").encode("utf-8")
- end
-
- def Ruby19.q_value_decode(str)
- match = str.match(/\=\?(.+)?\?[Qq]\?(.+)?\?\=/m)
- if match
- encoding = match[1]
- str = Encodings::QuotedPrintable.decode(match[2])
- str.force_encoding(fix_encoding(encoding))
- end
- decoded = str.encode("utf-8", :invalid => :replace, :replace => "")
- decoded.valid_encoding? ? decoded : decoded.encode("utf-16le", :invalid => :replace, :replace => "").encode("utf-8")
- end
-
- # mails somtimes includes invalid encodings like iso885915 or utf8 so we transform them to iso885915 or utf8
- # TODO: add this as a test somewhere
- # Encoding.list.map{|e| [e.to_s.upcase==fix_encoding(e.to_s.downcase.gsub("-", "")), e.to_s] }.select {|a,b| !b}
- # Encoding.list.map{|e| [e.to_s==fix_encoding(e.to_s), e.to_s] }.select {|a,b| !b}
- def Ruby19.fix_encoding(encoding)
- case encoding
- # ISO-8859-15, ISO-2022-JP and alike
- when /iso-?(\d{4})-?(\w{1,2})/i then return "ISO-#{$1}-#{$2}"
- # "ISO-2022-JP-KDDI" and alike
- when /iso-?(\d{4})-?(\w{1,2})-?(\w*)/i then return "ISO-#{$1}-#{$2}-#{$3}"
- # UTF-8, UTF-32BE and alike
- when /utf-?(\d{1,2})?(\w{1,2})/i then return "UTF-#{$1}#{$2}"
- # Windows-1252 and alike
- when /Windows-?(.*)/i then return "Windows-#{$1}"
- #more aliases to be added if needed
- else return encoding
- end
- end
- end
end