@@ -1573,12 +1573,6 @@ def login(user, password)
1573
1573
# or when existing messages are expunged; see #add_response_handler for a
1574
1574
# way to detect these events.
1575
1575
#
1576
- # When the +condstore+ keyword argument is true, the server is told to
1577
- # enable the extension. If +mailbox+ supports persistence of mod-sequences,
1578
- # the +HIGHESTMODSEQ+ ResponseCode will be sent as an untagged response to
1579
- # #select and all `FETCH` responses will include FetchData#modseq.
1580
- # Otherwise, the +NOMODSEQ+ ResponseCode will be sent.
1581
- #
1582
1576
# A Net::IMAP::NoResponseError is raised if the mailbox does not
1583
1577
# exist or is for some reason non-selectable.
1584
1578
#
@@ -1593,9 +1587,22 @@ def login(user, password)
1593
1587
# imap.responses("NO", &:last)&.code&.name == "UIDNOTSTICKY"
1594
1588
#
1595
1589
# If [CONDSTORE[https://www.rfc-editor.org/rfc/rfc7162.html]] is supported,
1596
- # the +condstore+ keyword parameter may be used.
1590
+ # the +condstore+ keyword parameter may be used. When the +condstore+
1591
+ # keyword argument is true, the server is told to enable the extension. If
1592
+ # +mailbox+ supports persistence of mod-sequences, the +HIGHESTMODSEQ+
1593
+ # ResponseCode will be sent as an untagged response to #select and all
1594
+ # `FETCH` responses will include FetchData#modseq. Otherwise, the
1595
+ # +NOMODSEQ+ ResponseCode will be sent.
1596
+ #
1597
1597
# imap.select("mbox", condstore: true)
1598
1598
# modseq = imap.responses("HIGHESTMODSEQ", &:last)
1599
+ #
1600
+ # If [QRESYNC[https://www.rfc-editor.org/rfc/rfc7162.html]] is enabled,
1601
+ # the +qresync+ keyword parameter may be used. The optional +qresync+
1602
+ # argument can provide quick resynchronization parameters: the last known
1603
+ # UIDVALIDITY, the last known MODSEQ, <em>(optional)</em> known UIDs, and
1604
+ # <em>(optional)</em> message sequence match data.
1605
+ #
1599
1606
def select ( ...)
1600
1607
select_internal ( "SELECT" , ...)
1601
1608
end
@@ -2975,9 +2982,6 @@ def uid_thread(algorithm, search_keys, charset)
2975
2982
# See {[RFC7162 §3.1]}[https://www.rfc-editor.org/rfc/rfc7162.html#section-3.1].
2976
2983
#
2977
2984
# [+QRESYNC+ {[RFC7162]}[https://www.rfc-editor.org/rfc/rfc7162.html]]
2978
- # *NOTE:* The +QRESYNC+ argument to #select and #examine is not supported
2979
- # yet.
2980
- #
2981
2985
# Adds quick resynchronization options to #select, #examine, and
2982
2986
# #uid_fetch. +QRESYNC+ _must_ be explicitly enabled before using any of
2983
2987
# the extension's command parameters. All +EXPUNGE+ responses will be
@@ -3600,9 +3604,12 @@ def enforce_logindisabled?
3600
3604
end
3601
3605
end
3602
3606
3603
- def select_internal ( command , mailbox , condstore : false )
3607
+ def select_internal ( command , mailbox , condstore : false , qresync : nil )
3604
3608
args = [ command , mailbox ]
3605
- args << [ "CONDSTORE" ] if condstore
3609
+ params = [ ]
3610
+ params << "CONDSTORE" if condstore
3611
+ params << "QRESYNC" << qresync if qresync # TODO: validate qresync params
3612
+ args << params unless params . empty?
3606
3613
synchronize do
3607
3614
state_unselected! # implicitly closes current mailbox
3608
3615
@responses . clear
0 commit comments