Skip to content

Commit f12ea3b

Browse files
committed
📚 Document "What's here?" for Net::IMAP class
This "What's here?" section is based on the new documentation style for many core ruby classes. It isn't purely a list of methods; paragraphs of explanatory text are interspersed. Many "TODO" comments are also added, hidden from rdoc by `--` and `++`.
1 parent 8e4c190 commit f12ea3b

File tree

1 file changed

+351
-0
lines changed

1 file changed

+351
-0
lines changed

lib/net/imap.rb

Lines changed: 351 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,357 @@ module Net
170170
# between UTF-8 and UTF-16), and Net::IMAP::ResponseParseError is
171171
# thrown if a server response is non-parseable.
172172
#
173+
# == What's here?
174+
#
175+
# * {Connection control}[rdoc-ref:Net::IMAP@Connection+control+methods]
176+
# * {Core IMAP commands}[rdoc-ref:Net::IMAP@Core+IMAP+commands]
177+
# * {...for any state}[rdoc-ref:Net::IMAP@IMAP+commands+for+any+state]
178+
# * {...for the "not authenticated" state}[rdoc-ref:Net::IMAP@IMAP+commands+for+the+-22Not+Authenticated-22+state]
179+
# * {...for the "authenticated" state}[rdoc-ref:Net::IMAP@IMAP+commands+for+the+-22Authenticated-22+state]
180+
# * {...for the "selected" state}[rdoc-ref:Net::IMAP@IMAP+commands+for+the+-22Selected-22+state]
181+
# * {...for the "logout" state}[rdoc-ref:Net::IMAP@IMAP+commands+for+the+-22Logout-22+state]
182+
# * {Supported IMAP extensions}[rdoc-ref:Net::IMAP@Supported+IMAP+extensions]
183+
# * {Handling server responses}[rdoc-ref:Net::IMAP@Handling+server+responses]
184+
#
185+
# === Connection control methods
186+
#
187+
# - Net::IMAP.new: A new client connects immediately and waits for a
188+
# successful server greeting before returning the new client object.
189+
# - #starttls: Asks the server to upgrade a clear-text connection to use TLS.
190+
# - #logout: Tells the server to end the session. Enters the "_logout_" state.
191+
# - #disconnect: Disconnects the connection (without sending #logout first).
192+
# - #disconnected?: True if the connection has been closed.
193+
#
194+
# === Core \IMAP commands
195+
#
196+
# The following commands are defined either by
197+
# the [IMAP4rev1[https://tools.ietf.org/html/rfc3501]] base specification, or
198+
# by one of the following extensions:
199+
# [IDLE[https://tools.ietf.org/html/rfc2177]],
200+
# [NAMESPACE[https://tools.ietf.org/html/rfc2342]],
201+
# [UNSELECT[https://tools.ietf.org/html/rfc3691]],
202+
#--
203+
# TODO: [ENABLE[https://tools.ietf.org/html/rfc5161]],
204+
# TODO: [LIST-EXTENDED[https://tools.ietf.org/html/rfc5258]],
205+
# TODO: [LIST-STATUS[https://tools.ietf.org/html/rfc5819]],
206+
#++
207+
# [MOVE[https://tools.ietf.org/html/rfc6851]].
208+
# These extensions are widely supported by modern IMAP4rev1 servers and have
209+
# all been integrated into [IMAP4rev2[https://tools.ietf.org/html/rfc9051]].
210+
# <em>Note: Net::IMAP doesn't fully support IMAP4rev2 yet.</em>
211+
#
212+
#--
213+
# TODO: When IMAP4rev2 is supported, add the following to the each of the
214+
# appropriate commands below.
215+
# Note:: CHECK has been removed from IMAP4rev2.
216+
# Note:: LSUB is obsoleted by +LIST-EXTENDED and has been removed from IMAP4rev2.
217+
# <em>Some arguments require the +LIST-EXTENDED+ or +IMAP4rev2+ capability.</em>
218+
# <em>Requires either the +ENABLE+ or +IMAP4rev2+ capability.</em>
219+
# <em>Requires either the +NAMESPACE+ or +IMAP4rev2+ capability.</em>
220+
# <em>Requires either the +IDLE+ or +IMAP4rev2+ capability.</em>
221+
# <em>Requires either the +UNSELECT+ or +IMAP4rev2+ capability.</em>
222+
# <em>Requires either the +UIDPLUS+ or +IMAP4rev2+ capability.</em>
223+
# <em>Requires either the +MOVE+ or +IMAP4rev2+ capability.</em>
224+
#++
225+
#
226+
# ==== \IMAP commands for any state
227+
#
228+
# - #capability: Returns the server's capabilities as an array of strings.
229+
#
230+
# <em>Capabilities may change after</em> #starttls, #authenticate, or #login
231+
# <em>and cached capabilities must be reloaded.</em>
232+
# - #noop: Allows the server to send unsolicited untagged #responses.
233+
# - #logout: Tells the server to end the session. Enters the "_logout_" state.
234+
#
235+
# ==== \IMAP commands for the "Not Authenticated" state
236+
#
237+
# In addition to the universal commands, the following commands are valid in
238+
# the "<em>not authenticated</em>" state:
239+
#
240+
# - #starttls: Upgrades a clear-text connection to use TLS.
241+
#
242+
# <em>Requires the +STARTTLS+ capability.</em>
243+
# - #authenticate: Identifies the client to the server using a {SASL
244+
# mechanism}[https://www.iana.org/assignments/sasl-mechanisms/sasl-mechanisms.xhtml].
245+
# Enters the "_authenticated_" state.
246+
#
247+
# <em>Requires the <tt>AUTH=#{mechanism}</tt> capability for the chosen
248+
# mechanism.</em>
249+
#
250+
# <em>The +LOGINDISABLED+ capability</em> <b>must NOT</b> <em>be listed.</em>
251+
# - #login: Identifies the client to the server using a simple plain text
252+
# username and password. Only use as a last resort (after attempting and
253+
# failing with #authenticate). Enters the "_authenticated_" state.
254+
#
255+
# <em>The +LOGINDISABLED+ capability</em> <b>must NOT</b> <em>be listed.</em>
256+
#
257+
# ==== \IMAP commands for the "Authenticated" state
258+
#
259+
# In addition to the universal commands, the following commands are valid in
260+
# the "_authenticated_" state:
261+
#
262+
#--
263+
# - #enable: <em>Not implemented by Net::IMAP, yet.</em>
264+
#
265+
# <em>Requires the +ENABLE+ capability.</em>
266+
#++
267+
# - #select: Open a mailbox and enter the "_selected_" state.
268+
# - #examine: Open a mailbox read-only, and enter the "_selected_" state.
269+
# - #create: Creates a new mailbox.
270+
# - #delete: Permanently remove a mailbox.
271+
# - #rename: Change the name of a mailbox.
272+
# - #subscribe: Adds a mailbox to the "subscribed" set.
273+
# - #unsubscribe: Removes a mailbox from the "subscribed" set.
274+
# - #list: Returns names and attributes of mailboxes matching a given pattern.
275+
# - #namespace: Returns mailbox namespaces, with path prefixes and delimiters.
276+
#
277+
# <em>Requires the +NAMESPACE+ capability.</em>
278+
# - #status: Returns mailbox information, e.g. message count, unseen message
279+
# count, +UIDVALIDITY+ and +UIDNEXT+.
280+
# - #append: Appends a message to the end of a mailbox.
281+
# - #idle: Allows the server to send updates to the client, without the client
282+
# needing to poll using #noop.
283+
#
284+
# <em>Requires the +IDLE+ capability.</em>
285+
# - #lsub: Lists mailboxes the user has declared "active" or "subscribed".
286+
#--
287+
# <em>Replaced by</em> <tt>LIST-EXTENDED</tt> <em>and removed from</em>
288+
# +IMAP4rev2+. <em>However, Net::IMAP hasn't implemented</em>
289+
# <tt>LIST-EXTENDED</tt> _yet_.
290+
#++
291+
#
292+
# ==== \IMAP commands for the "Selected" state
293+
#
294+
# In addition to the universal commands and the "authenticated" commands, the
295+
# following commands are valid in the "_selected_" state:
296+
#
297+
# - #close: Closes the mailbox and returns to the "_authenticated_" state,
298+
# expunging deleted messages, unless the mailbox was opened as read-only.
299+
# - #unselect: Closes the mailbox and returns to the "_authenticated_" state,
300+
# without expunging any messages.
301+
#
302+
# <em>Requires the +UNSELECT+ capability.</em>
303+
# - #expunge: Permanently removes messages which have the Deleted flag set.
304+
# - #uid_expunge: Restricts #expunge to only remove the specified UIDs.
305+
#
306+
# <em>Requires the +UIDPLUS+ capability.</em>
307+
# - #search, #uid_search: Returns sequence numbers or UIDs of messages that
308+
# match the given searching criteria.
309+
# - #fetch, #uid_fetch: Returns data associated with a set of messages,
310+
# specified by sequence number or UID.
311+
# - #store, #uid_store: Alters a message's flags.
312+
# - #copy, #uid_copy: Copies the specified messages to the end of the
313+
# specified destination mailbox.
314+
# - #move, #uid_move: Moves the specified messages to the end of the
315+
# specified destination mailbox, expunging them from the current mailbox.
316+
#
317+
# <em>Requires the +MOVE+ capability.</em>
318+
# - #check: Mostly obsolete. Can be replaced with #noop or #idle.
319+
#--
320+
# <em>Removed from IMAP4rev2.</em>
321+
#++
322+
#
323+
# ==== \IMAP commands for the "Logout" state
324+
#
325+
# No \IMAP commands are valid in the +logout+ state. If the socket is still
326+
# open, Net::IMAP will close it after receiving server confirmation.
327+
# Exceptions will be raised by \IMAP commands that have already started and
328+
# are waiting for a response, as well as any that are called after logout.
329+
#
330+
# === Supported \IMAP extensions
331+
#
332+
# ==== RFC9051: +IMAP4rev2+
333+
#
334+
# Although IMAP4rev2[https://tools.ietf.org/html/rfc9051] is <em>not supported
335+
# yet</em>, Net::IMAP supports several extensions that have been folded into
336+
# it: +IDLE+, +MOVE+, +NAMESPACE+, +UIDPLUS+, and +UNSELECT+.
337+
#--
338+
# TODO: RFC4466, ABNF extensions (automatic support for other extensions)
339+
# TODO: +ESEARCH+, ExtendedSearchData
340+
# TODO: +SEARCHRES+,
341+
# TODO: +ENABLE+,
342+
# TODO: +SASL-IR+,
343+
# TODO: +LIST-EXTENDED+,
344+
# TODO: +LIST-STATUS+,
345+
# TODO: +LITERAL-+,
346+
# TODO: +BINARY+ (only the FETCH side)
347+
# TODO: +SPECIAL-USE+
348+
# implicitly supported, but we can do better: Response codes: RFC5530, etc
349+
# implicitly supported, but we can do better: <tt>STATUS=SIZE</tt>
350+
# implicitly supported, but we can do better: <tt>STATUS DELETED</tt>
351+
#++
352+
# Commands for these extensions are included with the {Core IMAP
353+
# commands}[rdoc-ref:Net::IMAP@Core+IMAP+commands], above. Other supported
354+
# extensons are listed below.
355+
#
356+
# ==== RFC2087: +QUOTA+
357+
# - #getquota: returns the resource usage and limits for a quota root
358+
# - #getquotaroot: returns the list of quota roots for a mailbox, as well as
359+
# their resource usage and limits.
360+
# - #setquota: sets the resource limits for a given quota root.
361+
#
362+
# ==== RFC2177: +IDLE+
363+
# Folded into IMAP4rev2[https://tools.ietf.org/html/rfc9051], so it is also
364+
# listed with {Core IMAP commands}[rdoc-ref:Net::IMAP@Core+IMAP+commands].
365+
# - #idle: Allows the server to send updates to the client, without the client
366+
# needing to poll using #noop.
367+
#
368+
# ==== RFC2342: +NAMESPACE+
369+
# Folded into IMAP4rev2[https://tools.ietf.org/html/rfc9051], so it is also
370+
# listed with {Core IMAP commands}[rdoc-ref:Net::IMAP@Core+IMAP+commands].
371+
# - #namespace: Returns mailbox namespaces, with path prefixes and delimiters.
372+
#
373+
# ==== RFC2971: +ID+
374+
# - #id: exchanges client and server implementation information.
375+
#
376+
#--
377+
# ==== RFC3502: +MULTIAPPEND+
378+
# TODO...
379+
#++
380+
#
381+
#--
382+
# ==== RFC3516: +BINARY+
383+
# TODO...
384+
#++
385+
#
386+
# ==== RFC3691: +UNSELECT+
387+
# Folded into IMAP4rev2[https://tools.ietf.org/html/rfc9051], so it is also
388+
# listed with {Core IMAP commands}[rdoc-ref:Net::IMAP@Core+IMAP+commands].
389+
# - #unselect: Closes the mailbox and returns to the "_authenticated_" state,
390+
# without expunging any messages.
391+
#
392+
# ==== RFC4314: +ACL+
393+
# - #getacl: lists the authenticated user's access rights to a mailbox.
394+
# - #setacl: sets the access rights for a user on a mailbox
395+
#--
396+
# TODO: #deleteacl, #listrights, #myrights
397+
#++
398+
# - *_Note:_* +DELETEACL+, +LISTRIGHTS+, and +MYRIGHTS+ are not supported yet.
399+
#
400+
# ==== RFC4315: +UIDPLUS+
401+
# Folded into IMAP4rev2[https://tools.ietf.org/html/rfc9051], so it is also
402+
# listed with {Core IMAP commands}[rdoc-ref:Net::IMAP@Core+IMAP+commands].
403+
# - #uid_expunge: Restricts #expunge to only remove the specified UIDs.
404+
# - Updates #select, #examine with the +UIDNOTSTICKY+ ResponseCode
405+
# - Updates #append with the +APPENDUID+ ResponseCode
406+
# - Updates #copy, #move with the +COPYUID+ ResponseCode
407+
#
408+
#--
409+
# ==== RFC4466: Collected Extensions to IMAP4 ABNF
410+
# TODO...
411+
# Folded into IMAP4rev2[https://tools.ietf.org/html/rfc9051], this RFC updates
412+
# the protocol to enable new optional parameters to many commands: #select,
413+
# #examine, #create, #rename, #fetch, #uid_fetch, #store, #uid_store, #search,
414+
# #uid_search, and #append. However, specific parameters are not defined.
415+
# Extensions to these commands use this syntax whenever possible. Net::IMAP
416+
# may be partially compatible with extensions to these commands, even without
417+
# any explicit support.
418+
#++
419+
#
420+
#--
421+
# ==== RFC4731 +ESEARCH+
422+
# TODO...
423+
# Folded into IMAP4rev2[https://tools.ietf.org/html/rfc9051].
424+
# - Updates #search, #uid_search to accept result options: +MIN+, +MAX+,
425+
# +ALL+, +COUNT+, and to return ExtendedSearchData.
426+
#++
427+
#
428+
#--
429+
# ==== RFC4959: +SASL-IR+
430+
# TODO...
431+
# Folded into IMAP4rev2[https://tools.ietf.org/html/rfc9051].
432+
# - Updates #authenticate to reduce round-trips for supporting mechanisms.
433+
#++
434+
#
435+
#--
436+
# ==== RFC4978: COMPRESS=DEFLATE
437+
# TODO...
438+
#++
439+
#
440+
#--
441+
# ==== RFC5182 +SEARCHRES+
442+
# TODO...
443+
# Folded into IMAP4rev2[https://tools.ietf.org/html/rfc9051].
444+
# - Updates #search, #uid_search with the +SAVE+ result option.
445+
# - Updates #copy, #uid_copy, #fetch, #uid_fetch, #move, #uid_move, #search,
446+
# #uid_search, #store, #uid_store, and #uid_expunge with ability to
447+
# reference the saved result of a previous #search or #uid_search command.
448+
#++
449+
#
450+
# ==== RFC5256: +SORT+
451+
# - #sort, #uid_sort: An alternate version of #search or #uid_search which
452+
# sorts the results by specified keys.
453+
# ==== RFC5256: +THREAD+
454+
# - #thread, #uid_thread: An alternate version of #search or #uid_search,
455+
# which arranges the results into ordered groups or threads according to a
456+
# chosen algorithm.
457+
#
458+
#--
459+
# ==== RFC5258 +LIST-EXTENDED+
460+
# TODO...
461+
# Folded into IMAP4rev2[https://tools.ietf.org/html/rfc9051], this updates the
462+
# protocol with new optional parameters to the #list command, adding a few of
463+
# its own. Net::IMAP may be forward-compatible with future #list extensions,
464+
# even without any explicit support.
465+
# - Updates #list to accept selection options: +SUBSCRIBED+, +REMOTE+, and
466+
# +RECURSIVEMATCH+, and return options: +SUBSCRIBED+ and +CHILDREN+.
467+
#++
468+
#
469+
#--
470+
# ==== RFC5819 +LIST-STATUS+
471+
# TODO...
472+
# Folded into IMAP4rev2[https://tools.ietf.org/html/rfc9051].
473+
# - Updates #list with +STATUS+ return option.
474+
#++
475+
#
476+
# ==== +XLIST+ (non-standard, deprecated)
477+
# - #xlist: replaced by +SPECIAL-USE+ attributes in #list responses.
478+
#
479+
#--
480+
# ==== RFC6154 +SPECIAL-USE+
481+
# TODO...
482+
# Folded into IMAP4rev2[https://tools.ietf.org/html/rfc9051].
483+
# - Updates #list with the +SPECIAL-USE+ selection and return options.
484+
#++
485+
#
486+
# ==== RFC6851: +MOVE+
487+
# Folded into IMAP4rev2[https://tools.ietf.org/html/rfc9051], so it is also
488+
# listed with {Core IMAP commands}[rdoc-ref:Net::IMAP@Core+IMAP+commands].
489+
# - #move, #uid_move: Moves the specified messages to the end of the
490+
# specified destination mailbox, expunging them from the current mailbox.
491+
#
492+
#--
493+
# ==== RFC6855: UTF8=ACCEPT
494+
# TODO...
495+
# ==== RFC6855: UTF8=ONLY
496+
# TODO...
497+
#++
498+
#
499+
#--
500+
# ==== RFC7888: <tt>LITERAL+</tt>, +LITERAL-+
501+
# TODO...
502+
# ==== RFC7162: +QRESYNC+
503+
# TODO...
504+
# ==== RFC7162: +CONDSTORE+
505+
# TODO...
506+
# ==== RFC8474: +OBJECTID+
507+
# TODO...
508+
# ==== RFC9208: +QUOTA+
509+
# TODO...
510+
#++
511+
#
512+
# === Handling server responses
513+
#
514+
# - #greeting: The server's initial untagged response, which can indicate a
515+
# pre-authenticated connection.
516+
# - #responses: The untagged responses, as a hash. Keys are the untagged
517+
# response type (e.g. "OK", "FETCH", "FLAGS") and response code (e.g.
518+
# "ALERT", "UIDVALIDITY", "UIDNEXT", "TRYCREATE", etc). Values are arrays
519+
# of UntaggedResponse or ResponseCode.
520+
# - #add_response_handler: Add a block to be called inside the receiver thread
521+
# with every server response.
522+
# - #remove_response_handler: Remove a previously added response handler.
523+
#
173524
#
174525
# == References
175526
#--

0 commit comments

Comments
 (0)