summaryrefslogtreecommitdiff
path: root/lib/net
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-07 04:05:44 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-07 04:05:44 +0000
commit9be3aa1767681caf5a441336eaf6408979a26649 (patch)
tree3b53f8e8fa570e2efca04ab10d6da5ca2c58901c /lib/net
parent0fce0545b607e1ac92457cc8523645c294c2d411 (diff)
* lib/net/imap.rb (body_type_attachment): parse body type
"ATTACHMENT". [ruby-core:44849] [Bug #6397] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net')
-rw-r--r--lib/net/imap.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/net/imap.rb b/lib/net/imap.rb
index 1f9682681e..567cf66809 100644
--- a/lib/net/imap.rb
+++ b/lib/net/imap.rb
@@ -1977,6 +1977,26 @@ module Net
end
end
+ # Net::IMAP::BodyTypeAttachment represents attachment body structures
+ # of messages.
+ #
+ # ==== Fields:
+ #
+ # media_type:: Returns the content media type name.
+ #
+ # subtype:: Returns +nil+.
+ #
+ # param:: Returns a hash that represents parameters.
+ #
+ # multipart?:: Returns false.
+ #
+ class BodyTypeAttachment < Struct.new(:media_type, :subtype,
+ :param)
+ def multipart?
+ return false
+ end
+ end
+
# Net::IMAP::BodyTypeMultipart represents multipart body structures
# of messages.
#
@@ -2347,6 +2367,8 @@ module Net
return body_type_text
when /\A(?:MESSAGE)\z/ni
return body_type_msg
+ when /\A(?:ATTACHMENT)\z/ni
+ return body_type_attachment
else
return body_type_basic
end
@@ -2399,6 +2421,13 @@ module Net
md5, disposition, language, extension)
end
+ def body_type_attachment
+ mtype = case_insensitive_string
+ match(T_SPACE)
+ param = body_fld_param
+ return BodyTypeAttachment.new(mtype, nil, param)
+ end
+
def body_type_mpart
parts = []
while true