ruby-changes:66070
From: nicholas <ko1@a...>
Date: Thu, 6 May 2021 15:20:57 +0900 (JST)
Subject: [ruby-changes:66070] affb51045c (master): [ruby/net-imap] move response data structs to net/imap/response_data
https://git.ruby-lang.org/ruby.git/commit/?id=affb51045c From affb51045cd38306ece58a6cd29f5b868a97dcfc Mon Sep 17 00:00:00 2001 From: "nicholas a. evans" <nicholas.evans@g...> Date: Mon, 3 May 2021 17:13:03 -0400 Subject: [ruby/net-imap] move response data structs to net/imap/response_data Partially implements #10. https://github.com/ruby/net-imap/commit/746757b936 --- lib/net/imap.rb | 503 +---------------------------------------- lib/net/imap/response_data.rb | 509 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 510 insertions(+), 502 deletions(-) create mode 100644 lib/net/imap/response_data.rb diff --git a/lib/net/imap.rb b/lib/net/imap.rb index 703b077..dad377d 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -22,6 +22,7 @@ begin https://github.com/ruby/ruby/blob/trunk/lib/net/imap.rb#L22 rescue LoadError end +require_relative "imap/response_data" require_relative "imap/response_parser" module Net @@ -1851,508 +1852,6 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/imap.rb#L1852 end end - # Net::IMAP::ContinuationRequest represents command continuation requests. - # - # The command continuation request response is indicated by a "+" token - # instead of a tag. This form of response indicates that the server is - # ready to accept the continuation of a command from the client. The - # remainder of this response is a line of text. - # - # continue_req ::= "+" SPACE (resp_text / base64) - # - # ==== Fields: - # - # data:: Returns the data (Net::IMAP::ResponseText). - # - # raw_data:: Returns the raw data string. - ContinuationRequest = Struct.new(:data, :raw_data) - - # Net::IMAP::UntaggedResponse represents untagged responses. - # - # Data transmitted by the server to the client and status responses - # that do not indicate command completion are prefixed with the token - # "*", and are called untagged responses. - # - # response_data ::= "*" SPACE (resp_cond_state / resp_cond_bye / - # mailbox_data / message_data / capability_data) - # - # ==== Fields: - # - # name:: Returns the name, such as "FLAGS", "LIST", or "FETCH". - # - # data:: Returns the data such as an array of flag symbols, - # a ((<Net::IMAP::MailboxList>)) object. - # - # raw_data:: Returns the raw data string. - UntaggedResponse = Struct.new(:name, :data, :raw_data) - - # Net::IMAP::IgnoredResponse represents intentionally ignored responses. - # - # This includes untagged response "NOOP" sent by eg. Zimbra to avoid some - # clients to close the connection. - # - # It matches no IMAP standard. - # - # ==== Fields: - # - # raw_data:: Returns the raw data string. - IgnoredResponse = Struct.new(:raw_data) - - # Net::IMAP::TaggedResponse represents tagged responses. - # - # The server completion result response indicates the success or - # failure of the operation. It is tagged with the same tag as the - # client command which began the operation. - # - # response_tagged ::= tag SPACE resp_cond_state CRLF - # - # tag ::= 1*<any ATOM_CHAR except "+"> - # - # resp_cond_state ::= ("OK" / "NO" / "BAD") SPACE resp_text - # - # ==== Fields: - # - # tag:: Returns the tag. - # - # name:: Returns the name, one of "OK", "NO", or "BAD". - # - # data:: Returns the data. See ((<Net::IMAP::ResponseText>)). - # - # raw_data:: Returns the raw data string. - # - TaggedResponse = Struct.new(:tag, :name, :data, :raw_data) - - # Net::IMAP::ResponseText represents texts of responses. - # The text may be prefixed by the response code. - # - # resp_text ::= ["[" resp-text-code "]" SP] text - # - # ==== Fields: - # - # code:: Returns the response code. See ((<Net::IMAP::ResponseCode>)). - # - # text:: Returns the text. - # - ResponseText = Struct.new(:code, :text) - - # Net::IMAP::ResponseCode represents response codes. - # - # resp_text_code ::= "ALERT" / - # "BADCHARSET" [SP "(" astring *(SP astring) ")" ] / - # capability_data / "PARSE" / - # "PERMANENTFLAGS" SP "(" - # [flag_perm *(SP flag_perm)] ")" / - # "READ-ONLY" / "READ-WRITE" / "TRYCREATE" / - # "UIDNEXT" SP nz_number / "UIDVALIDITY" SP nz_number / - # "UNSEEN" SP nz_number / - # atom [SP 1*<any TEXT-CHAR except "]">] - # - # ==== Fields: - # - # name:: Returns the name, such as "ALERT", "PERMANENTFLAGS", or "UIDVALIDITY". - # - # data:: Returns the data, if it exists. - # - ResponseCode = Struct.new(:name, :data) - - # Net::IMAP::MailboxList represents contents of the LIST response. - # - # mailbox_list ::= "(" #("\Marked" / "\Noinferiors" / - # "\Noselect" / "\Unmarked" / flag_extension) ")" - # SPACE (<"> QUOTED_CHAR <"> / nil) SPACE mailbox - # - # ==== Fields: - # - # attr:: Returns the name attributes. Each name attribute is a symbol - # capitalized by String#capitalize, such as :Noselect (not :NoSelect). - # - # delim:: Returns the hierarchy delimiter. - # - # name:: Returns the mailbox name. - # - MailboxList = Struct.new(:attr, :delim, :name) - - # Net::IMAP::MailboxQuota represents contents of GETQUOTA response. - # This object can also be a response to GETQUOTAROOT. In the syntax - # specification below, the delimiter used with the "#" construct is a - # single space (SPACE). - # - # quota_list ::= "(" #quota_resource ")" - # - # quota_resource ::= atom SPACE number SPACE number - # - # quota_response ::= "QUOTA" SPACE astring SPACE quota_list - # - # ==== Fields: - # - # mailbox:: The mailbox with the associated quota. - # - # usage:: Current storage usage of the mailbox. - # - # quota:: Quota limit imposed on the mailbox. - # - MailboxQuota = Struct.new(:mailbox, :usage, :quota) - - # Net::IMAP::MailboxQuotaRoot represents part of the GETQUOTAROOT - # response. (GETQUOTAROOT can also return Net::IMAP::MailboxQuota.) - # - # quotaroot_response ::= "QUOTAROOT" SPACE astring *(SPACE astring) - # - # ==== Fields: - # - # mailbox:: The mailbox with the associated quota. - # - # quotaroots:: Zero or more quotaroots that affect the quota on the - # specified mailbox. - # - MailboxQuotaRoot = Struct.new(:mailbox, :quotaroots) - - # Net::IMAP::MailboxACLItem represents the response from GETACL. - # - # acl_data ::= "ACL" SPACE mailbox *(SPACE identifier SPACE rights) - # - # identifier ::= astring - # - # rights ::= astring - # - # ==== Fields: - # - # user:: Login name that has certain rights to the mailbox - # that was specified with the getacl command. - # - # rights:: The access rights the indicated user has to the - # mailbox. - # - MailboxACLItem = Struct.new(:user, :rights, :mailbox) - - # Net::IMAP::Namespace represents a single [RFC-2342] namespace. - # - # Namespace = nil / "(" 1*( "(" string SP (<"> QUOTED_CHAR <"> / - # nil) *(Namespace_Response_Extension) ")" ) ")" - # - # Namespace_Response_Extension = SP string SP "(" string *(SP string) - # ")" - # - # ==== Fields: - # - # prefix:: Returns the namespace prefix string. - # delim:: Returns nil or the hierarchy delimiter character. - # extensions:: Returns a hash of extension names to extension flag arrays. - # - Namespace = Struct.new(:prefix, :delim, :extensions) - - # Net::IMAP::Namespaces represents the response from [RFC-2342] NAMESPACE. - # - # Namespace_Response = "*" SP "NAMESPACE" SP Namespace SP Namespace SP - # Namespace - # - # ; The first Namespace is the Personal Namespace(s) - # ; The second Namespace is the Other Users' Namespace(s) - # ; The third Namespace is the Shared Namespace(s) - # - # ==== Fields: - # - # personal:: Returns an array of Personal Net::IMAP::Namespace objects. - # other:: Returns an array of Other Users' Net::IMAP::Namespace objects. - # shared:: Returns an array of Shared Net::IMAP::Namespace objects. - # - Namespaces = Struct.new(:personal, :other, :shared) - - # Net::IMAP::StatusData represents the contents of the STATUS response. - # - # ==== Fields: - # - # mailbox:: Returns the mailbox name. - # - # attr:: Returns a hash. Each key is one of "MESSAGES", "RECENT", "UIDNEXT", - # "UIDVALIDITY", "UNSEEN". Each value is a number. - # - StatusData = Struct.new(:mailbox, :attr) - - # Net::IMAP::FetchData represents the contents of the FETCH response. - # - # ==== Fields: - # - # seqno:: Returns the message sequence number. - # (Note: not the unique identifier, even for the UID command response.) - # - # attr:: Returns a hash. Each key is a data item name, and each value is - # its value. - # - # The current data items are: - # - # [BODY] - # A form of BODYSTRUCTURE without extension data. - # [BODY[<section>]<<origin_octet>>] - # A string expressing the body contents of the specified section. - # [BODYSTRUCTURE] - # An object that describes the [MIME-IMB] body structure of a message. - # See Net::IMAP::BodyTypeBasic, Net::IMAP::BodyTypeText, - # Net::IMAP::BodyTypeMessage, Net::IMAP::BodyTypeMultipart. - # [ENVELOPE] - # A Net::IMAP::Envelope object that describes the envelope - (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/