Skip to content

Commit f63c807

Browse files
committed
📚 Document "What's here?" for Net::IMAP class [🚧 tidy up...]
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.
1 parent 6d03dac commit f63c807

File tree

1 file changed

+198
-0
lines changed

1 file changed

+198
-0
lines changed

lib/net/imap.rb

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,204 @@ module Net
154154
# between UTF-8 and UTF-16), and Net::IMAP::ResponseParseError is
155155
# thrown if a server response is non-parseable.
156156
#
157+
# == What's here?
158+
#
159+
# * {Connection control}[rdoc-ref:Net::IMAP@Connection+control+methods]
160+
# * {Core IMAP commands}[rdoc-ref:Net::IMAP@Core+IMAP+commands]
161+
# * {...in any state}[rdoc-ref:Net::IMAP@IMAP+commands+for+any+state]
162+
# * {...in "not authenticated" state}[rdoc-ref:Net::IMAP@IMAP+commands+for+the+-22Not+Authenticated-22+state]
163+
# * {...in "authenticated" state}[rdoc-ref:Net::IMAP@IMAP+commands+for+the+-22Authenticated-22+state]
164+
# * {...in "selected" state}[rdoc-ref:Net::IMAP@IMAP+commands+for+the+-22Selected-22+state]
165+
# * {...in "logout" state}[rdoc-ref:Net::IMAP@IMAP+commands+for+the+-22Logout-22+state]
166+
# * {IMAP extensions}[rdoc-ref:Net::IMAP@Supported+IMAP+extensions]
167+
# * {Handling server responses}[rdoc-ref:Net::IMAP@Handling+server+responses]
168+
#
169+
# === Connection control methods
170+
#
171+
# - Net::IMAP.new: A new client connects immediately and waits for a
172+
# successful server greeting before returning the new client object.
173+
# - #starttls: Asks the server to upgrade a clear-text connection to use TLS.
174+
# - #logout: Tells the server to end the session. Enters the "_logout_" state.
175+
# - #disconnect: Disconnects the connection (without sending #logout first).
176+
# - #disconnected?: True if the connection has been closed.
177+
#
178+
# === Core \IMAP commands
179+
#
180+
# The following commands are defined either by
181+
# the [IMAP4rev1[https://tools.ietf.org/html/rfc3501]] base specification, or
182+
# by one of the following extensions:
183+
# [IDLE[https://tools.ietf.org/html/rfc2177]],
184+
# [NAMESPACE[https://tools.ietf.org/html/rfc2342]],
185+
# [UNSELECT[https://tools.ietf.org/html/rfc3691]],
186+
#--
187+
# TODO: [ENABLE[https://tools.ietf.org/html/rfc5161]],
188+
# TODO: [LIST-EXTENDED[https://tools.ietf.org/html/rfc5258]],
189+
# TODO: [LIST-STATUS[https://tools.ietf.org/html/rfc5819]],
190+
#++
191+
# [MOVE[https://tools.ietf.org/html/rfc6851]].
192+
# These extensions are widely supported by modern IMAP4rev1 servers and have
193+
# all been integrated into [IMAP4rev2[https://tools.ietf.org/html/rfc9051]].
194+
# <em>Note: Net::IMAP doesn't fully support IMAP4rev2 yet.</em>
195+
#
196+
#--
197+
# TODO: When IMAP4rev2 is supported, add the following to the each of the
198+
# appropriate commands below.
199+
# Note:: CHECK has been removed from IMAP4rev2.
200+
# Note:: LSUB is obsoleted by +LIST-EXTENDED and has been removed from IMAP4rev2.
201+
# <em>Some arguments require the +LIST-EXTENDED+ or +IMAP4rev2+ capability.</em>
202+
# <em>Requires either the +ENABLE+ or +IMAP4rev2+ capability.</em>
203+
# <em>Requires either the +NAMESPACE+ or +IMAP4rev2+ capability.</em>
204+
# <em>Requires either the +IDLE+ or +IMAP4rev2+ capability.</em>
205+
# <em>Requires either the +UNSELECT+ or +IMAP4rev2+ capability.</em>
206+
# <em>Requires either the +UIDPLUS+ or +IMAP4rev2+ capability.</em>
207+
# <em>Requires either the +MOVE+ or +IMAP4rev2+ capability.</em>
208+
#++
209+
#
210+
# ==== \IMAP commands for any state
211+
#
212+
# - #capability: Returns the server's capabilities as an array of strings.
213+
#
214+
# <em>Capabilities may change after</em> #starttls, #authenticate, or #login
215+
# <em>and cached capabilities must be reloaded.</em>
216+
# - #noop: Allows the server to send unsolicited untagged #responses.
217+
# - #logout: Tells the server to end the session. Enters the "_logout_" state.
218+
#
219+
# ==== \IMAP commands for the "Not Authenticated" state
220+
#
221+
# In addition to the universal commands, the following commands are valid in
222+
# the "<em>not authenticated</em>" state:
223+
#
224+
# - #starttls: Upgrades a clear-text connection to use TLS.
225+
#
226+
# <em>Requires the +STARTTLS+ capability.</em>
227+
# - #authenticate: Identifies the client to the server using a {SASL
228+
# mechanism}[https://www.iana.org/assignments/sasl-mechanisms/sasl-mechanisms.xhtml].
229+
# Enters the "_authenticated_" state.
230+
#
231+
# <em>Requires the <tt>AUTH=#{mechanism}</tt> capability for the chosen
232+
# mechanism.</em>
233+
#
234+
# <em>The +LOGINDISABLED+ capability</em> <b>must NOT</b> <em>be listed.</em>
235+
# - #login: Identifies the client to the server using a simple plain text
236+
# username and password. Only use as a last resort (after attempting and
237+
# failing with #authenticate). Enters the "_authenticated_" state.
238+
#
239+
# <em>The +LOGINDISABLED+ capability</em> <b>must NOT</b> <em>be listed.</em>
240+
#
241+
# ==== \IMAP commands for the "Authenticated" state
242+
#
243+
# In addition to the universal commands, the following commands are valid in
244+
# the "_authenticated_" state:
245+
#
246+
#--
247+
# - #enable: <em>Not implemented by Net::IMAP, yet.</em>
248+
#
249+
# <em>Requires the +ENABLE+ capability.</em>
250+
#++
251+
# - #select: Open a mailbox and enter the "_selected_" state.
252+
# - #examine: Open a mailbox read-only, and enter the "_selected_" state.
253+
# - #create: Creates a new mailbox.
254+
# - #delete: Permanently remove a mailbox.
255+
# - #rename: Change the name of a mailbox.
256+
# - #subscribe: Adds a mailbox to the "subscribed" set.
257+
# - #unsubscribe: Removes a mailbox from the "subscribed" set.
258+
# - #list: Returns names and attributes of mailboxes matching a given pattern.
259+
# - #namespace: Returns the namespaces for personal mailboxes, other users'
260+
# mailboxes, and shared mailboxes, with the prefixes and path delimiters
261+
# used for the mailbox names within each namespace.
262+
#
263+
# <em>Requires the +NAMESPACE+ capability.</em>
264+
# - #status: Returns mailbox information, e.g. message count, unseen message
265+
# count, +UIDVALIDITY+ and +UIDNEXT+.
266+
# - #append: Appends a message to the end of a mailbox.
267+
# - #idle: Allows the server to send updates to the client, without the client
268+
# needing to poll using #noop.
269+
#
270+
# <em>Requires the +IDLE+ capability.</em>
271+
# - #lsub: Lists mailboxes the user has declared "active" or "subscribed".
272+
#
273+
# ==== \IMAP commands for the "Selected" state
274+
#
275+
# In addition to the universal commands and the "authenticated" commands, the
276+
# following commands are valid in the "_selected_" state:
277+
#
278+
# - #close: Closes the mailbox and returns to the "_authenticated_" state.
279+
# Messages with the Deleted flag are permanently removed, unless the mailbox
280+
# was opened as read-only.
281+
# - #unselect: Closes the mailbox and returns to the "_authenticated_" state,
282+
# without expunging any messages.
283+
#
284+
# <em>Requires the +UNSELECT+ capability.</em>
285+
# - #expunge: Permanently removes messages which have the Deleted flag set.
286+
# - #uid_expunge: Restricts #expunge to only remove the specified UIDs.
287+
#
288+
# <em>Requires the +UIDPLUS+ capability.</em>
289+
# - #search, #uid_search: Returns sequence numbers or UIDs of messages that
290+
# match the given searching criteria.
291+
# - #fetch, #uid_fetch: Returns data associated with a set of messages,
292+
# specified by sequence number or UID.
293+
# - #store, #uid_store: Alters a message's flags.
294+
# - #copy, #uid_copy: Copies the specified messages to the end of the
295+
# specified destination mailbox.
296+
# - #move, #uid_move: Moves the specified messages to the end of the
297+
# specified destination mailbox, expunging them from the current mailbox.
298+
#
299+
# <em>Requires the +MOVE+ capability.</em>
300+
# - #check: Mostly obsolete. Can be replaced with #noop or #idle.
301+
#
302+
# ==== \IMAP commands for the "Logout" state
303+
#
304+
# No \IMAP commands are valid in the +logout+ state. If the socket is still
305+
# open, Net::IMAP will close it after receiving server confirmation.
306+
# Exceptions will be raised by \IMAP commands that have already started and
307+
# are waiting for a response, as well as any that are called after logout.
308+
#
309+
# === Supported \IMAP extensions
310+
#
311+
# ==== +IMAP4rev2+ [RFC9051[https://tools.ietf.org/html/rfc9051]]
312+
#
313+
# Although IMAP4rev2[https://tools.ietf.org/html/rfc9051] is <em>not supported
314+
# yet</em>, Net::IMAP supports several extensions that have been folded into
315+
# it: +IDLE+, +MOVE+, +NAMESPACE+, +UIDPLUS+, and +UNSELECT+.
316+
#--
317+
# TODO: +ENABLE+, +LIST-EXTENDED+, +LIST-STATUS+
318+
#++
319+
# Commands for these extensions are included with the {Core IMAP
320+
# commands}[rdoc-ref:Net::IMAP@Core+IMAP+commands], above. Other supported
321+
# extensons are listed below.
322+
#
323+
# ==== +ID+ [RFC2971[https://tools.ietf.org/html/rfc2971]]
324+
# - #id: exchanges client and server implementation information.
325+
# ==== +QUOTA+ [RFC2087[https://tools.ietf.org/html/rfc2087]]
326+
# - #getquota: returns the resource usage and limits for a quota root
327+
# - #getquotaroot: returns the list of quota roots for a mailbox, as well as
328+
# their resource usage and limits.
329+
# - #setquota: sets the resource limits for a given quota root.
330+
# ==== +ACL+ [RFC4314[https://tools.ietf.org/html/rfc4314]]
331+
# - #getacl: lists the authenticated user's access rights to a mailbox.
332+
# - #setacl: sets the access rights for a user on a mailbox
333+
# ==== +SORT+ [RFC5256[https://tools.ietf.org/html/rfc5256]]
334+
# - #sort, #uid_sort: An alternate version of #search or #uid_search which
335+
# sorts the results by specified keys.
336+
# ==== +THREAD+ [RFC5256[https://tools.ietf.org/html/rfc5256]]
337+
# - #thread, #uid_thread: An alternate version of #search or #uid_search,
338+
# which arranges the results into ordered groups or threads according to a
339+
# chosen algorithm.
340+
# ==== +XLIST+ (non-standard, deprecated)
341+
# - #xlist: replaced by +SPECIAL-USE+ attributes in #list responses.
342+
#
343+
# === Handling server responses
344+
#
345+
# - #greeting: The server's initial untagged response, which can indicate a
346+
# pre-authenticated connection.
347+
# - #responses: The untagged responses, as a hash. Keys are the untagged
348+
# response type (e.g. "OK", "FETCH", "FLAGS") and response code (e.g.
349+
# "ALERT", "UIDVALIDITY", "UIDNEXT", "TRYCREATE", etc). Values are arrays
350+
# of UntaggedResponse or ResponseCode.
351+
# - #add_response_handler: Add a block to be called inside the receiver thread
352+
# with every server response.
353+
# - #remove_response_handler: Remove a previously added response handler.
354+
#
157355
#
158356
# == References
159357
#--

0 commit comments

Comments
 (0)