@@ -434,20 +434,22 @@ def login(user, password)
434
434
# Sends a SELECT command to select a +mailbox+ so that messages
435
435
# in the +mailbox+ can be accessed.
436
436
#
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 .
443
443
#
444
444
# A Net::IMAP::NoResponseError is raised if the mailbox does not
445
445
# exist or is for some reason non-selectable.
446
446
#
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:
451
453
# @responses["NO"].last.code.name == "UIDNOTSTICKY"
452
454
def select ( mailbox )
453
455
synchronize do
@@ -759,22 +761,24 @@ def status(mailbox, attr)
759
761
# not exist (it is not created automatically), or if the flags,
760
762
# date_time, or message arguments contain errors.
761
763
#
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
+ #++
765
774
def append ( mailbox , message , flags = nil , date_time = nil )
766
775
args = [ ]
767
776
if flags
768
777
args . push ( flags )
769
778
end
770
779
args . push ( date_time ) if date_time
771
780
args . push ( Literal . new ( message ) )
772
- synchronize do
773
- resp = send_command ( "APPEND" , mailbox , *args )
774
- if resp . data . code && resp . data . code . name == "APPENDUID"
775
- return resp . data . code . data
776
- end
777
- end
781
+ send_command ( "APPEND" , mailbox , *args )
778
782
end
779
783
780
784
# Sends a CHECK command to request a checkpoint of the currently
@@ -818,8 +822,10 @@ def expunge
818
822
# #responses and this method returns them as an array of
819
823
# <em>sequence number</em> integers.
820
824
#
821
- # ==== Required capability
822
- # +UIDPLUS+ - described in [UIDPLUS[https://www.rfc-editor.org/rfc/rfc4315.html]].
825
+ # ==== Capability requirement
826
+ #
827
+ # +UIDPLUS+ [RFC4315[https://www.rfc-editor.org/rfc/rfc4315.html]] must be
828
+ # supported by the server.
823
829
def uid_expunge ( uid_set )
824
830
synchronize do
825
831
send_command ( "UID EXPUNGE" , MessageSet . new ( uid_set ) )
@@ -948,14 +954,21 @@ def uid_store(set, attr, flags)
948
954
# a number, an array of numbers, or a Range object. The number is
949
955
# a message sequence number.
950
956
#
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.
957
+ # ==== Capabilities
958
+ #
959
+ # If +UIDPLUS+ [RFC4315[https://www.rfc-editor.org/rfc/rfc4315.html]] is
960
+ # supported, the server's response should include a +COPYUID+ response code
961
+ # with the UIDVALIDITY of the destination mailbox, the UID set of the source
962
+ # messages, and the assigned UID set of the moved messages.
954
963
def copy ( set , mailbox )
955
964
copy_internal ( "COPY" , set , mailbox )
956
965
end
957
966
958
967
# Similar to #copy, but +set+ contains unique identifiers.
968
+ #
969
+ # ==== Capabilities
970
+ #
971
+ # +UIDPLUS+ affects #uid_copy the same way it affects #copy.
959
972
def uid_copy ( set , mailbox )
960
973
copy_internal ( "UID COPY" , set , mailbox )
961
974
end
@@ -965,18 +978,27 @@ def uid_copy(set, mailbox)
965
978
# a number, an array of numbers, or a Range object. The number is
966
979
# a message sequence number.
967
980
#
968
- # The MOVE extension is described in [EXT-MOVE[https://tools.ietf.org/html/rfc6851]].
981
+ # ==== Capabilities requirements
982
+ #
983
+ # +MOVE+ [RFC6851[https://tools.ietf.org/html/rfc6851]] must be supported by
984
+ # the server.
985
+ #
986
+ # If +UIDPLUS+ [RFC4315[https://www.rfc-editor.org/rfc/rfc4315.html]] is
987
+ # also supported, the server's response should include a +COPYUID+ response
988
+ # code with the UIDVALIDITY of the destination mailbox, the UID set of the
989
+ # source messages, and the assigned UID set of the moved messages.
969
990
#
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.
973
991
def move ( set , mailbox )
974
992
copy_internal ( "MOVE" , set , mailbox )
975
993
end
976
994
977
995
# Similar to #move, but +set+ contains unique identifiers.
978
996
#
979
- # The MOVE extension is described in [EXT-MOVE[https://tools.ietf.org/html/rfc6851]].
997
+ # ==== Capabilities requirements
998
+ #
999
+ # Same as #move: +MOVE+ [RFC6851[https://tools.ietf.org/html/rfc6851]] must
1000
+ # be supported by the server. +UIDPLUS+ also affects #uid_move the same way
1001
+ # it affects #move.
980
1002
def uid_move ( set , mailbox )
981
1003
copy_internal ( "UID MOVE" , set , mailbox )
982
1004
end
@@ -1432,12 +1454,7 @@ def store_internal(cmd, set, attr, flags)
1432
1454
end
1433
1455
1434
1456
def copy_internal ( cmd , set , mailbox )
1435
- synchronize do
1436
- resp = send_command ( cmd , MessageSet . new ( set ) , mailbox )
1437
- if resp . data . code && resp . data . code . name == "COPYUID"
1438
- return resp . data . code . data
1439
- end
1440
- end
1457
+ send_command ( cmd , MessageSet . new ( set ) , mailbox )
1441
1458
end
1442
1459
1443
1460
def sort_internal ( cmd , sort_keys , search_keys , charset )
0 commit comments