Skip to content

Commit be253f3

Browse files
committed
📚 Document EXPUNGE, fetch/store/search, idle/noop
* Add paragraph to class-level docs, about expunge messages. * Add explanation to #noop docs, explaining EXPUNGE responses * Update #uid_expunge docs with method link instead of command name.
1 parent b0e91f7 commit be253f3

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

lib/net/imap.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ module Net
6161
# are expunged from the mailbox, remaining messages have their
6262
# sequence numbers "shuffled down" to fill the gaps.
6363
#
64+
# To avoid sequence number race conditions, servers must not expunge messages
65+
# when no command is in progress, nor when responding to #fetch, #store, or
66+
# #search. Expunges _may_ be sent during any other command, including
67+
# #uid_fetch, #uid_store, and #uid_search. The #noop and #idle commands are
68+
# both useful for this side-effect: they allow the server to send all mailbox
69+
# updates, including expunges.
70+
#
6471
# UIDs, on the other hand, are permanently guaranteed not to
6572
# identify another message within the same mailbox, even if
6673
# the existing message is deleted. UIDs are required to
@@ -530,6 +537,14 @@ def id(client_id=nil)
530537
# Sends a {NOOP command [IMAP4rev1 §6.1.2]}[https://www.rfc-editor.org/rfc/rfc3501#section-6.1.2]
531538
# to the server.
532539
#
540+
# This allows the server to send unsolicited untagged EXPUNGE #responses,
541+
# but does not execute any client request. \IMAP servers are permitted to
542+
# send unsolicited untagged responses at any time, except for `EXPUNGE`.
543+
#
544+
# * +EXPUNGE+ can only be sent while a command is in progress.
545+
# * +EXPUNGE+ must _not_ be sent during #fetch, #store, or #search.
546+
# * +EXPUNGE+ may be sent during #uid_fetch, #uid_store, or #uid_search.
547+
#
533548
# Related: #idle, #check
534549
def noop
535550
send_command("NOOP")
@@ -1138,7 +1153,7 @@ def expunge
11381153
# to permanently remove all messages that have both the <tt>\\Deleted</tt>
11391154
# flag set and a UID that is included in +uid_set+.
11401155
#
1141-
# By using UID EXPUNGE instead of EXPUNGE when resynchronizing with
1156+
# By using #uid_expunge instead of #expunge when resynchronizing with
11421157
# the server, the client can ensure that it does not inadvertantly
11431158
# remove any messages that have been marked as <tt>\\Deleted</tt> by other
11441159
# clients between the time that the client was last connected and

0 commit comments

Comments
 (0)