Skip to content

Commit a29563f

Browse files
committed
✨ Parse all CONDSTORE response codes (RFC7162)
* `NOMODSEQ` _(already previously supported)_ * `HIGHESTMODSEQ` * `MODIFIED`
1 parent 5f39345 commit a29563f

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/net/imap/response_data.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,16 @@ class ResponseText < Struct.new(:code, :text)
292292
# because the server doesn't allow deletion of mailboxes with children.
293293
# #data is +nil+.
294294
#
295+
# ==== +CONDSTORE+ extension
296+
# See {[RFC7162]}[https://www.rfc-editor.org/rfc/rfc7162.html].
297+
# * +NOMODSEQ+, when selecting a mailbox that does not support
298+
# mod-sequences. #data is +nil+. See IMAP#select.
299+
# * +HIGHESTMODSEQ+, #data is an Integer, the highest mod-sequence value of
300+
# all messages in the mailbox. See IMAP#select.
301+
# * +MODIFIED+, #data is a SequenceSet, the messages that have been modified
302+
# since the +UNCHANGEDSINCE+ mod-sequence given to +STORE+ or <tt>UID
303+
# STORE</tt>.
304+
#
295305
# ==== +OBJECTID+ extension
296306
# See {[RFC8474]}[https://www.rfc-editor.org/rfc/rfc8474.html].
297307
# * +MAILBOXID+, #data is a string

lib/net/imap/response_parser.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1802,6 +1802,8 @@ def resp_text
18021802
# resp-text-code =/ "HIGHESTMODSEQ" SP mod-sequence-value /
18031803
# "NOMODSEQ" /
18041804
# "MODIFIED" SP sequence-set
1805+
# RFC7162 (QRESYNC):
1806+
# resp-text-code =/ "CLOSED"
18051807
#
18061808
# RFC8474: OBJECTID
18071809
# resp-text-code =/ "MAILBOXID" SP "(" objectid ")"
@@ -1823,7 +1825,9 @@ def resp_text_code
18231825
"EXPUNGEISSUED", "CORRUPTION", "SERVERBUG", "CLIENTBUG", "CANNOT",
18241826
"LIMIT", "OVERQUOTA", "ALREADYEXISTS", "NONEXISTENT", "CLOSED",
18251827
"NOTSAVED", "UIDNOTSTICKY", "UNKNOWN-CTE", "HASCHILDREN"
1826-
when "NOMODSEQ" # CONDSTORE
1828+
when "NOMODSEQ" then nil # CONDSTORE
1829+
when "HIGHESTMODSEQ" then SP!; mod_sequence_value # CONDSTORE
1830+
when "MODIFIED" then SP!; sequence_set # CONDSTORE
18271831
when "MAILBOXID" then SP!; parens__objectid # RFC8474: OBJECTID
18281832
else
18291833
SP? and text_chars_except_rbra

0 commit comments

Comments
 (0)