Permalink
Browse files

Adding initialization of @charset everywhere

  • Loading branch information...
1 parent 80b9b82 commit 85fd50a60c839eca1aa59ce0238b513efaf5d8e4 @mikel committed Apr 9, 2010
View
@@ -30,6 +30,7 @@ def initialize(string = '')
@boundary = nil
@preamble = nil
@epilogue = nil
+ @charset = nil
@part_sort_order = [ "text/plain", "text/enriched", "text/html" ]
@parts = Mail::PartsList.new
if string.blank?
@@ -37,6 +37,7 @@ class CcField < StructuredField
CAPITALIZED_FIELD = 'Cc'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
self.parse
self
@@ -9,10 +9,10 @@ class ContentDescriptionField < UnstructuredField
CAPITALIZED_FIELD = 'Content-Description'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
self.parse
self
-
end
end
@@ -8,10 +8,10 @@ class ContentDispositionField < StructuredField
CAPITALIZED_FIELD = 'Content-Disposition'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
self.parse
self
-
end
def parse(val = value)
@@ -9,6 +9,7 @@ class ContentIdField < StructuredField
CAPITALIZED_FIELD = "Content-ID"
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
@uniq = 1
if value.blank?
value = generate_content_id
@@ -9,10 +9,10 @@ class ContentLocationField < StructuredField
CAPITALIZED_FIELD = 'Content-Location'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
self.parse
self
-
end
def parse(val = value)
@@ -9,6 +9,7 @@ class ContentTransferEncodingField < StructuredField
CAPITALIZED_FIELD = 'Content-Transfer-Encoding'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
value = '7bit' if value.to_s =~ /7-bit/i
value = '8bit' if value.to_s =~ /8-bit/i
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
@@ -8,6 +8,7 @@ class ContentTypeField < StructuredField
CAPITALIZED_FIELD = 'Content-Type'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
if value.class == Array
@main_type = value[0]
@sub_type = value[1]
@@ -32,6 +32,7 @@ class DateField < StructuredField
CAPITALIZED_FIELD = "Date"
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
if value.blank?
value = Time.now.strftime('%a, %d %b %Y %H:%M:%S %z')
else
@@ -37,6 +37,7 @@ class FromField < StructuredField
CAPITALIZED_FIELD = 'From'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
self.parse
self
@@ -37,6 +37,7 @@ class InReplyToField < StructuredField
CAPITALIZED_FIELD = 'In-Reply-To'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
self.parse
self
@@ -8,6 +8,7 @@ class KeywordsField < StructuredField
CAPITALIZED_FIELD = 'Keywords'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
self.parse
self
@@ -39,6 +39,7 @@ class MessageIdField < StructuredField
CAPITALIZED_FIELD = 'Message-ID'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
@uniq = 1
if value.blank?
self.name = CAPITALIZED_FIELD
@@ -9,6 +9,7 @@ class MimeVersionField < StructuredField
CAPITALIZED_FIELD = 'Mime-Version'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
if value.blank?
value = '1.0'
end
@@ -26,6 +26,7 @@ class ReceivedField < StructuredField
CAPITALIZED_FIELD = 'Received'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
self.parse
self
@@ -37,6 +37,7 @@ class ReferencesField < StructuredField
CAPITALIZED_FIELD = 'References'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
self.parse
self
@@ -37,6 +37,7 @@ class ReplyToField < StructuredField
CAPITALIZED_FIELD = 'Reply-To'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
self.parse
self
@@ -37,6 +37,7 @@ class ResentBccField < StructuredField
CAPITALIZED_FIELD = 'Resent-Bcc'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
self.parse
self
@@ -37,6 +37,7 @@ class ResentCcField < StructuredField
CAPITALIZED_FIELD = 'Resent-Cc'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
self.parse
self
@@ -12,7 +12,7 @@ class ResentDateField < StructuredField
CAPITALIZED_FIELD = 'Resent-Date'
def initialize(value = nil, charset = 'utf-8')
- @charset = charset
+ self.charset = charset
if value.blank?
value = Time.now.strftime('%a, %d %b %Y %H:%M:%S %z')
else
@@ -37,6 +37,7 @@ class ResentFromField < StructuredField
CAPITALIZED_FIELD = 'Resent-From'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
self.parse
self
@@ -12,10 +12,10 @@ class ResentMessageIdField < StructuredField
CAPITALIZED_FIELD = 'Resent-Message-ID'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
self.parse
self
-
end
def name
@@ -36,6 +36,7 @@ class ResentSenderField < StructuredField
CAPITALIZED_FIELD = 'Resent-Sender'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
self.parse
self
@@ -37,6 +37,7 @@ class ResentToField < StructuredField
CAPITALIZED_FIELD = 'Resent-To'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
self.parse
self
@@ -38,10 +38,10 @@ class ReturnPathField < StructuredField
CAPITALIZED_FIELD = 'Return-Path'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
self.parse
self
-
end
def encoded
@@ -37,6 +37,7 @@ class SenderField < StructuredField
CAPITALIZED_FIELD = 'Sender'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
self.parse
self
@@ -8,6 +8,7 @@ class SubjectField < UnstructuredField
CAPITALIZED_FIELD = "Subject"
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
end
@@ -37,6 +37,7 @@ class ToField < StructuredField
CAPITALIZED_FIELD = 'To'
def initialize(value = nil, charset = 'utf-8')
+ self.charset = charset
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
self.parse
self
@@ -20,6 +20,7 @@ class UnstructuredField
include Mail::Utilities
def initialize(name, value, charset = nil)
+ self.charset = charset
@errors = []
if charset
self.charset = charset

0 comments on commit 85fd50a

Please sign in to comment.