@@ -160,13 +160,20 @@ class TaggedResponse < Struct.new(:tag, :name, :data, :raw_data)
160
160
# The raw response data.
161
161
end
162
162
163
- # Net::IMAP:: ResponseText represents texts of responses.
163
+ # ResponseText represents texts of responses.
164
164
#
165
165
# The text may be prefixed by a ResponseCode.
166
166
#
167
- # ResponseText is returned from TaggedResponse#data, or from
168
- # UntaggedResponse#data when the response type is a "condition" ("OK", "NO",
169
- # "BAD", "PREAUTH", or "BYE").
167
+ # ResponseText is returned from TaggedResponse#data or
168
+ # UntaggedResponse#data for
169
+ # {"status responses"}[https://www.rfc-editor.org/rfc/rfc3501#section-7.1]:
170
+ # * every TaggedResponse, name[rdoc-ref:TaggedResponse#name] is always
171
+ # "+OK+", "+NO+", or "+BAD+".
172
+ # * any UntaggedResponse when name[rdoc-ref:UntaggedResponse#name] is
173
+ # "+OK+", "+NO+", "+BAD+", "+PREAUTH+", or "+BYE+".
174
+ #
175
+ # Note that these "status responses" are confusingly _not_ the same as the
176
+ # +STATUS+ UntaggedResponse (see IMAP#status and StatusData).
170
177
class ResponseText < Struct . new ( :code , :text )
171
178
# Used to avoid an allocation when ResponseText is empty
172
179
EMPTY = new ( nil , "" ) . freeze
@@ -184,32 +191,35 @@ class ResponseText < Struct.new(:code, :text)
184
191
# Returns the response text, not including any response code
185
192
end
186
193
187
- # Net::IMAP::ResponseCode represents response codes. Response codes can be
188
- # retrieved from ResponseText#code and can be included in any "condition"
189
- # response: any TaggedResponse and UntaggedResponse when the response type
190
- # is a "condition" ("OK", "NO", "BAD", "PREAUTH", or "BYE").
194
+ # ResponseCode represents an \IMAP response code, which can be retrieved
195
+ # from ResponseText#code for
196
+ # {"status responses"}[https://www.rfc-editor.org/rfc/rfc3501#section-7.1]:
197
+ # * every TaggedResponse, name[rdoc-ref:TaggedResponse#name] is always
198
+ # "+OK+", "+NO+", or "+BAD+".
199
+ # * any UntaggedResponse when name[rdoc-ref:UntaggedResponse#name] is
200
+ # "+OK+", "+NO+", "+BAD+", "+PREAUTH+", or "+BYE+".
201
+ #
202
+ # Note that these "status responses" are confusingly _not_ the same as the
203
+ # +STATUS+ UntaggedResponse (see IMAP#status and StatusData).
191
204
#
192
205
# Some response codes come with additional data which will be parsed by
193
206
# Net::IMAP. Others return +nil+ for #data, but are used as a
194
207
# machine-readable annotation for the human-readable ResponseText#text in
195
- # the same response. When Net::IMAP does not know how to parse response
196
- # code text, #data returns the unparsed string.
208
+ # the same response.
197
209
#
198
210
# Untagged response code #data is pushed directly onto Net::IMAP#responses,
199
211
# keyed by #name, unless it is removed by the command that generated it.
200
212
# Use Net::IMAP#add_response_handler to view tagged response codes for
201
213
# command methods that do not return their TaggedResponse.
202
214
#
215
+ # == Standard response codes
216
+ #
203
217
# \IMAP extensions may define new codes and the data that comes with them.
204
218
# The IANA {IMAP Response
205
219
# Codes}[https://www.iana.org/assignments/imap-response-codes/imap-response-codes.xhtml]
206
220
# registry has links to specifications for all standard response codes.
207
- # Response codes are backwards compatible: Servers are allowed to send new
208
- # response codes even if the client has not enabled the extension that
209
- # defines them. When unknown response code data is encountered, #data
210
- # will return an unparsed string.
211
221
#
212
- # ==== +IMAP4rev1+ Response Codes
222
+ # === +IMAP4rev1+ response codes
213
223
# See [IMAP4rev1[https://www.rfc-editor.org/rfc/rfc3501]] {§7.1, "Server
214
224
# Responses - Status
215
225
# Responses"}[https://www.rfc-editor.org/rfc/rfc3501#section-7.1] for full
@@ -240,24 +250,24 @@ class ResponseText < Struct.new(:code, :text)
240
250
# the <tt>\Seen</tt> flag set.
241
251
# <em>DEPRECATED by IMAP4rev2.</em>
242
252
#
243
- # ==== +BINARY+ extension
253
+ # === +BINARY+ extension
244
254
# See {[RFC3516]}[https://www.rfc-editor.org/rfc/rfc3516].
245
255
# * +UNKNOWN-CTE+, with a tagged +NO+ response, when the server does not
246
256
# known how to decode a CTE (content-transfer-encoding). #data is +nil+.
247
257
# See IMAP#fetch.
248
258
#
249
- # ==== +UIDPLUS+ extension
259
+ # === +UIDPLUS+ extension
250
260
# See {[RFC4315 §3]}[https://www.rfc-editor.org/rfc/rfc4315#section-3].
251
261
# * +APPENDUID+, #data is UIDPlusData. See IMAP#append.
252
262
# * +COPYUID+, #data is UIDPlusData. See IMAP#copy.
253
263
# * +UIDNOTSTICKY+, #data is +nil+. See IMAP#select.
254
264
#
255
- # ==== +SEARCHRES+ extension
265
+ # === +SEARCHRES+ extension
256
266
# See {[RFC5182]}[https://www.rfc-editor.org/rfc/rfc5182].
257
267
# * +NOTSAVED+, with a tagged +NO+ response, when the search result variable
258
268
# is not saved. #data is +nil+.
259
269
#
260
- # ==== +RFC5530+ Response Codes
270
+ # === +RFC5530+ response codes
261
271
# See {[RFC5530]}[https://www.rfc-editor.org/rfc/rfc5530], "IMAP Response
262
272
# Codes" for the definition of the following response codes, which are all
263
273
# machine-readable annotations for the human-readable ResponseText#text, and
@@ -280,22 +290,22 @@ class ResponseText < Struct.new(:code, :text)
280
290
# * +ALREADYEXISTS+
281
291
# * +NONEXISTENT+
282
292
#
283
- # ==== +QRESYNC+ extension
293
+ # === +QRESYNC+ extension
284
294
# See {[RFC7162]}[https://www.rfc-editor.org/rfc/rfc7162.html].
285
295
# * +CLOSED+, returned when the currently selected mailbox is closed
286
296
# implicitly by selecting or examining another mailbox. #data is +nil+.
287
297
#
288
- # ==== +IMAP4rev2+ Response Codes
298
+ # === +IMAP4rev2+ response codes
289
299
# See {[RFC9051]}[https://www.rfc-editor.org/rfc/rfc9051] {§7.1, "Server
290
300
# Responses - Status
291
301
# Responses"}[https://www.rfc-editor.org/rfc/rfc9051#section-7.1] for full
292
302
# descriptions of IMAP4rev2 response codes. IMAP4rev2 includes all of the
293
- # response codes listed above (except "UNSEEN") and adds the following:
303
+ # response codes listed above (except "+ UNSEEN+ ") and adds the following:
294
304
# * +HASCHILDREN+, with a tagged +NO+ response, when a mailbox delete failed
295
305
# because the server doesn't allow deletion of mailboxes with children.
296
306
# #data is +nil+.
297
307
#
298
- # ==== +CONDSTORE+ extension
308
+ # === +CONDSTORE+ extension
299
309
# See {[RFC7162]}[https://www.rfc-editor.org/rfc/rfc7162.html].
300
310
# * +NOMODSEQ+, when selecting a mailbox that does not support
301
311
# mod-sequences. #data is +nil+. See IMAP#select.
@@ -305,10 +315,17 @@ class ResponseText < Struct.new(:code, :text)
305
315
# since the +UNCHANGEDSINCE+ mod-sequence given to +STORE+ or <tt>UID
306
316
# STORE</tt>.
307
317
#
308
- # ==== +OBJECTID+ extension
318
+ # === +OBJECTID+ extension
309
319
# See {[RFC8474]}[https://www.rfc-editor.org/rfc/rfc8474.html].
310
320
# * +MAILBOXID+, #data is a string
311
321
#
322
+ # == Extension compatibility
323
+ #
324
+ # Response codes are backwards compatible: Servers are allowed to send new
325
+ # response codes even if the client has not enabled the extension that
326
+ # defines them. When Net::IMAP does not know how to parse response
327
+ # code text, #data returns the unparsed string.
328
+ #
312
329
class ResponseCode < Struct . new ( :name , :data )
313
330
##
314
331
# method: name
0 commit comments