Skip to content

Commit b370314

Browse files
committed
✨ Add STATUS HIGHESTMODSEQ (RFC7162, CONDSTORE)
This doesn't actually require explicit support, because `HIGHESTMODSEQ` is simply another numeric status attribute, and we already parse `number` as the default (without using `ExtensionData`).
1 parent 022048e commit b370314

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

lib/net/imap.rb

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,10 @@ module Net
502502
#
503503
# - See #enable for information about support for UTF-8 string encoding.
504504
#
505+
# ==== RFC7162: +CONDSTORE+
506+
#
507+
# - Updates #status with the +HIGHESTMODSEQ+ status attribute.
508+
#
505509
# ==== RFC8438: <tt>STATUS=SIZE</tt>
506510
# - Updates #status with the +SIZE+ status attribute.
507511
#
@@ -1689,7 +1693,7 @@ def lsub(refname, mailbox)
16891693
end
16901694
end
16911695

1692-
# Sends a {STATUS commands [IMAP4rev1 §6.3.10]}[https://www.rfc-editor.org/rfc/rfc3501#section-6.3.10]
1696+
# Sends a {STATUS command [IMAP4rev1 §6.3.10]}[https://www.rfc-editor.org/rfc/rfc3501#section-6.3.10]
16931697
# and returns the status of the indicated +mailbox+. +attr+ is a list of one
16941698
# or more attributes whose statuses are to be requested.
16951699
#
@@ -1716,10 +1720,13 @@ def lsub(refname, mailbox)
17161720
# The approximate size of the mailbox---must be greater than or equal to
17171721
# the sum of all messages' +RFC822.SIZE+ fetch item values.
17181722
#
1723+
# +HIGHESTMODSEQ+::
1724+
# The highest mod-sequence value of all messages in the mailbox. See
1725+
# +CONDSTORE+ {[RFC7162]}[https://www.rfc-editor.org/rfc/rfc7162.html].
1726+
#
17191727
# +MAILBOXID+::
1720-
# A server-allocated unique _string_ identifier for the mailbox.
1721-
# See +OBJECTID+
1722-
# {[RFC8474]}[https://www.rfc-editor.org/rfc/rfc8474.html#section-4].
1728+
# A server-allocated unique _string_ identifier for the mailbox. See
1729+
# +OBJECTID+ {[RFC8474]}[https://www.rfc-editor.org/rfc/rfc8474.html].
17231730
#
17241731
# +RECENT+::
17251732
# The number of messages with the <tt>\Recent</tt> flag.
@@ -1741,6 +1748,9 @@ def lsub(refname, mailbox)
17411748
#
17421749
# +DELETED+ requires the server's capabilities to include +IMAP4rev2+.
17431750
#
1751+
# +HIGHESTMODSEQ+ requires the server's capabilities to include +CONDSTORE+
1752+
# {[RFC7162]}[https://www.rfc-editor.org/rfc/rfc7162.html].
1753+
#
17441754
# +MAILBOXID+ requires the server's capabilities to include +OBJECTID+
17451755
# {[RFC8474]}[https://www.rfc-editor.org/rfc/rfc8474.html].
17461756
def status(mailbox, attr)

lib/net/imap/response_parser.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,6 +1594,7 @@ def status_att_val
15941594
when "UIDVALIDITY" then nz_number # RFC3501, RFC9051
15951595
when "RECENT" then number # RFC3501 (obsolete)
15961596
when "SIZE" then number64 # RFC8483, RFC9051
1597+
when "HIGHESTMODSEQ" then mod_sequence_valzer # RFC7162
15971598
when "MAILBOXID" then parens__objectid # RFC8474
15981599
else
15991600
number? || ExtensionData.new(tagged_ext_val)
@@ -1966,6 +1967,10 @@ def charset; quoted? || atom end
19661967
# ;; Per-message mod-sequence.
19671968
alias permsg_modsequence mod_sequence_value
19681969

1970+
# RFC7162:
1971+
# mod-sequence-valzer = "0" / mod-sequence-value
1972+
alias mod_sequence_valzer number64
1973+
19691974
def parens__modseq; lpar; _ = permsg_modsequence; rpar; _ end
19701975

19711976
# RFC8474:

0 commit comments

Comments
 (0)