Skip to content

Commit 7e95dc3

Browse files
committed
Update documentation for new UIDPLUS support
Mostly just adds/updates how different capabilities affect each command.
1 parent 1e80875 commit 7e95dc3

File tree

1 file changed

+50
-23
lines changed

1 file changed

+50
-23
lines changed

lib/net/imap.rb

Lines changed: 50 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -434,20 +434,22 @@ def login(user, password)
434434
# Sends a SELECT command to select a +mailbox+ so that messages
435435
# in the +mailbox+ can be accessed.
436436
#
437-
# After you have selected a mailbox, you may retrieve the
438-
# number of items in that mailbox from <code>@responses["EXISTS"][-1]</code>,
439-
# and the number of recent messages from <code>@responses["RECENT"][-1]</code>.
440-
# Note that these values can change if new messages arrive
441-
# during a session; see #add_response_handler for a way of
442-
# detecting this event.
437+
# After you have selected a mailbox, you may retrieve the number of items in
438+
# that mailbox from <tt>imap.responses["EXISTS"][-1]</tt>, and the number of
439+
# recent messages from <tt>imap.responses["RECENT"][-1]</tt>. Note that
440+
# these values can change if new messages arrive during a session or when
441+
# existing messages are expunged; see #add_response_handler for a way to
442+
# detect these events.
443443
#
444444
# A Net::IMAP::NoResponseError is raised if the mailbox does not
445445
# exist or is for some reason non-selectable.
446446
#
447-
# If the server supports the [UIDPLUS[https://www.rfc-editor.org/rfc/rfc4315.html]]
448-
# extension it may return an additional "NO" response with a "UIDNOTSTICKY" response code
449-
# indicating that the mailstore does not support persistent UIDs
450-
# [1[https://www.rfc-editor.org/rfc/rfc4315.html#page-4]]:
447+
# ==== Capabilities
448+
#
449+
# If [UIDPLUS[https://www.rfc-editor.org/rfc/rfc4315.html]] is supported,
450+
# the server may return an untagged "NO" response with a "UIDNOTSTICKY"
451+
# response code indicating that the mailstore does not support persistent
452+
# UIDs:
451453
# @responses["NO"].last.code.name == "UIDNOTSTICKY"
452454
def select(mailbox)
453455
synchronize do
@@ -759,9 +761,16 @@ def status(mailbox, attr)
759761
# not exist (it is not created automatically), or if the flags,
760762
# date_time, or message arguments contain errors.
761763
#
762-
# If the server supports the [UIDPLUS[https://www.rfc-editor.org/rfc/rfc4315.html]]
763-
# extension it returns an array with the UIDVALIDITY and the assigned UID of the
764-
# appended message.
764+
# ==== Capabilities
765+
#
766+
# If +UIDPLUS+ [RFC4315[https://www.rfc-editor.org/rfc/rfc4315.html]] is
767+
# supported, the server's response should include a +APPENDUID+ response
768+
# code with the UIDVALIDITY of the destination mailbox and the assigned UID
769+
# of the appended message.
770+
#
771+
#--
772+
# TODO: add MULTIAPPEND support
773+
#++
765774
def append(mailbox, message, flags = nil, date_time = nil)
766775
args = []
767776
if flags
@@ -818,8 +827,10 @@ def expunge
818827
# #responses and this method returns them as an array of
819828
# <em>sequence number</em> integers.
820829
#
821-
# ==== Required capability
822-
# +UIDPLUS+ - described in [UIDPLUS[https://www.rfc-editor.org/rfc/rfc4315.html]].
830+
# ==== Capability requirement
831+
#
832+
# +UIDPLUS+ [RFC4315[https://www.rfc-editor.org/rfc/rfc4315.html]] must be
833+
# supported by the server.
823834
def uid_expunge(uid_set)
824835
synchronize do
825836
send_command("UID EXPUNGE", MessageSet.new(uid_set))
@@ -948,14 +959,21 @@ def uid_store(set, attr, flags)
948959
# a number, an array of numbers, or a Range object. The number is
949960
# a message sequence number.
950961
#
951-
# If the server supports the [UIDPLUS[https://www.rfc-editor.org/rfc/rfc4315.html]]
952-
# extension it returns an array with the UIDVALIDITY, the UID set of the source messages
953-
# and the assigned UID set of the copied messages.
962+
# ==== Capabilities
963+
#
964+
# If +UIDPLUS+ [RFC4315[https://www.rfc-editor.org/rfc/rfc4315.html]] is
965+
# supported, the server's response should include a +COPYUID+ response code
966+
# with the UIDVALIDITY of the destination mailbox, the UID set of the source
967+
# messages, and the assigned UID set of the moved messages.
954968
def copy(set, mailbox)
955969
copy_internal("COPY", set, mailbox)
956970
end
957971

958972
# Similar to #copy, but +set+ contains unique identifiers.
973+
#
974+
# ==== Capabilities
975+
#
976+
# +UIDPLUS+ affects #uid_copy the same way it affects #copy.
959977
def uid_copy(set, mailbox)
960978
copy_internal("UID COPY", set, mailbox)
961979
end
@@ -965,18 +983,27 @@ def uid_copy(set, mailbox)
965983
# a number, an array of numbers, or a Range object. The number is
966984
# a message sequence number.
967985
#
968-
# The MOVE extension is described in [EXT-MOVE[https://tools.ietf.org/html/rfc6851]].
986+
# ==== Capabilities requirements
987+
#
988+
# +MOVE+ [RFC6851[https://tools.ietf.org/html/rfc6851]] must be supported by
989+
# the server.
990+
#
991+
# If +UIDPLUS+ [RFC4315[https://www.rfc-editor.org/rfc/rfc4315.html]] is
992+
# also supported, the server's response should include a +COPYUID+ response
993+
# code with the UIDVALIDITY of the destination mailbox, the UID set of the
994+
# source messages, and the assigned UID set of the moved messages.
969995
#
970-
# If the server supports the [UIDPLUS[https://www.rfc-editor.org/rfc/rfc4315.html]]
971-
# extension it returns an array with the UIDVALIDITY, the UID set of the source messages
972-
# and the assigned UID set of the moved messages.
973996
def move(set, mailbox)
974997
copy_internal("MOVE", set, mailbox)
975998
end
976999

9771000
# Similar to #move, but +set+ contains unique identifiers.
9781001
#
979-
# The MOVE extension is described in [EXT-MOVE[https://tools.ietf.org/html/rfc6851]].
1002+
# ==== Capabilities requirements
1003+
#
1004+
# Same as #move: +MOVE+ [RFC6851[https://tools.ietf.org/html/rfc6851]] must
1005+
# be supported by the server. +UIDPLUS+ also affects #uid_move the same way
1006+
# it affects #move.
9801007
def uid_move(set, mailbox)
9811008
copy_internal("UID MOVE", set, mailbox)
9821009
end

0 commit comments

Comments
 (0)