Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow assigning arrays of Message-IDs to References and In-Reply-To. …

…Closes #85.
  • Loading branch information...
commit c62f5502bbab42cb17f66abdabfaffd2654b324a 1 parent 832cfcc
@jeremy jeremy authored
View
1  CHANGELOG.rdoc
@@ -1,6 +1,7 @@
== HEAD
Features:
+* Can assign arrays of Message-IDs to References and In-Reply-To (jeremy)
* Setting the html_ or text_part sets a default text/html or text/plain content type (jeremy)
* Setting the html_ or text_part to nil removes it (jeremy)
* Addresses without a parsable email or display name still format as their raw text (jeremy)
View
1  lib/mail/fields/in_reply_to_field.rb
@@ -38,6 +38,7 @@ class InReplyToField < StructuredField
def initialize(value = nil, charset = 'utf-8')
self.charset = charset
+ value = value.join("\r\n\s") if value.is_a?(Array)
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
self.parse
self
View
1  lib/mail/fields/references_field.rb
@@ -38,6 +38,7 @@ class ReferencesField < StructuredField
def initialize(value = nil, charset = 'utf-8')
self.charset = charset
+ value = value.join("\r\n\s") if value.is_a?(Array)
super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
self.parse
self
View
5 spec/mail/fields/in_reply_to_field_spec.rb
@@ -40,6 +40,11 @@
t.encoded.should eq "In-Reply-To: <1234@test.lindsaar.net>\r\n <4567@test.lindsaar.net>\r\n"
end
+ it "should handle an array of message IDs" do
+ t = Mail::InReplyToField.new(['<1234@test.lindsaar.net>', '<4567@test.lindsaar.net>'])
+ t.encoded.should eq "In-Reply-To: <1234@test.lindsaar.net>\r\n <4567@test.lindsaar.net>\r\n"
+ end
+
it "should provide decoded" do
t = Mail::InReplyToField.new('<1234@test.lindsaar.net>')
t.decoded.should eq "<1234@test.lindsaar.net>"
View
5 spec/mail/fields/references_field_spec.rb
@@ -41,6 +41,11 @@
t.to_s.should eq '<1234@test.lindsaar.net> <5678@test.lindsaar.net>'
end
+ it "should accept an array of message ids" do
+ t = Mail::ReferencesField.new(['<1234@test.lindsaar.net>', '<5678@test.lindsaar.net>'])
+ t.encoded.should eq "References: <1234@test.lindsaar.net>\r\n <5678@test.lindsaar.net>\r\n"
+ end
+
it "should accept no message ids" do
t = Mail::ReferencesField.new('')
t.name.should eq 'References'
Please sign in to comment.
Something went wrong with that request. Please try again.