mail 1.3.5 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of mail might be problematic. Click here for more details.
- data/CHANGELOG.rdoc +5 -0
- data/README.rdoc +2 -2
- data/Rakefile +1 -1
- data/lib/mail/body.rb +5 -4
- data/lib/mail/header.rb +7 -1
- data/lib/mail/message.rb +5 -3
- data/lib/mail/version.rb +2 -2
- metadata +1 -1
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== Sun Dec 27 09:51:27 UTC 2009 Mikel Lindsaar <raasdnil@gmail.com>
|
2
|
+
|
3
|
+
* Version bump to 1.4 because now :to_s calls :decoded for all fields and body while
|
4
|
+
:to_s calls :encoded for Message and Header containers. Makes sense... really.
|
5
|
+
|
1
6
|
== Sun Dec 27 07:30:02 UTC 2009 Mikel Lindsaar <raasdnil@gmail.com>
|
2
7
|
|
3
8
|
* Changed fields to default to :decoded on :to_s, all container objects retain :encoded as the default for :to_s
|
data/README.rdoc
CHANGED
@@ -113,8 +113,8 @@ I have tried to simplify it some:
|
|
113
113
|
3. By default, calling :to_s on a container object will call it's encoded method, while
|
114
114
|
:to_s on a field object will call it's decoded method. So calling :to_s on a Mail
|
115
115
|
object will return the mail, all encoded ready to send, while calling :to_s on the
|
116
|
-
From field will return the decoded value of the
|
117
|
-
|
116
|
+
From field or the body will return the decoded value of the object. The header object
|
117
|
+
of Mail is considered a container. If you are in doubt, call :encoded, or :decoded
|
118
118
|
explicitly, this is safer if you are not sure.
|
119
119
|
|
120
120
|
4. Structured fields that have parameter values that can be encoded (e.g. Content-Type) will
|
data/Rakefile
CHANGED
data/lib/mail/body.rb
CHANGED
@@ -97,16 +97,13 @@ module Mail
|
|
97
97
|
# raw source. Need to implement
|
98
98
|
def encoded
|
99
99
|
if multipart?
|
100
|
-
encoded_parts = parts.map { |p| p.
|
100
|
+
encoded_parts = parts.map { |p| p.encoded }
|
101
101
|
([preamble] + encoded_parts).join(crlf_boundary) + end_boundary + epilogue.to_s
|
102
102
|
else
|
103
103
|
raw_source.to_crlf
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
107
|
-
alias :to_s :encoded
|
108
|
-
|
109
|
-
# Returns the raw source right now. Need to implement
|
110
107
|
def decoded
|
111
108
|
if encoding.nil? || !Encodings.defined?(encoding)
|
112
109
|
raw_source.to_lf
|
@@ -115,6 +112,10 @@ module Mail
|
|
115
112
|
end
|
116
113
|
end
|
117
114
|
|
115
|
+
def to_s
|
116
|
+
decoded
|
117
|
+
end
|
118
|
+
|
118
119
|
def charset
|
119
120
|
@charset
|
120
121
|
end
|
data/lib/mail/header.rb
CHANGED
@@ -165,7 +165,13 @@ module Mail
|
|
165
165
|
buffer
|
166
166
|
end
|
167
167
|
|
168
|
-
|
168
|
+
def to_s
|
169
|
+
encoded
|
170
|
+
end
|
171
|
+
|
172
|
+
def decoded
|
173
|
+
raise NoMethodError, 'Can not decode an entire header as there could be character set conflicts, try calling #decoded on the various fields.'
|
174
|
+
end
|
169
175
|
|
170
176
|
# Returns true if the header has a Message-ID defined (empty or not)
|
171
177
|
def has_message_id?
|
data/lib/mail/message.rb
CHANGED
@@ -764,8 +764,10 @@ module Mail
|
|
764
764
|
buffer
|
765
765
|
end
|
766
766
|
|
767
|
-
|
768
|
-
|
767
|
+
def to_s
|
768
|
+
encoded
|
769
|
+
end
|
770
|
+
|
769
771
|
def decoded
|
770
772
|
raise NoMethodError, 'Can not decode an entire message, try calling #decoded on the various fields and body or parts if it is a multipart message.'
|
771
773
|
end
|
@@ -900,7 +902,7 @@ module Mail
|
|
900
902
|
if filename = attachment?
|
901
903
|
encoding = content_transfer_encoding.encoding if content_transfer_encoding
|
902
904
|
@attachment = Mail::Attachment.new(:filename => filename,
|
903
|
-
:data => body.
|
905
|
+
:data => body.encoded,
|
904
906
|
:encoding => encoding)
|
905
907
|
end
|
906
908
|
end
|
data/lib/mail/version.rb
CHANGED