Cite RFC 7162 for SEARCH MODSEQ entry types

The docs described these as RFC 5464 GETMETADATA options, with
GETMETADATA examples. The grammar is RFC 7162 `search-modseq-ext`.
This commit is contained in:
Daniel Eggert committed 2026-10-29 15:51:59 +01:00
1 parent 307c23d1d7
commit 640d65236e
4 files changed
+44 -72

No files matched your search

@@ -12,33 +12,32 @@
//
//===----------------------------------------------------------------------===//
/// A metadata entry name for a system flag used with metadata operations (RFC 5464).
/// The flag whose modification sequence a `SEARCH MODSEQ` criterion tests (RFC 7162 `entry-flag-name`).
///
/// **Requires server capability:** ``Capability/metadata`` or ``Capability/metadataServer``
/// **Requires server capability:** ``Capability/condStore``
///
/// Wraps an ``AttributeFlag`` to represent it as a metadata entry name in the special
/// `/flags/` namespace. Flag entries allow metadata operations on flag modification sequences
/// through the entry name format `/flags/flagname`. See [RFC 5464](https://datatracker.ietf.org/doc/html/rfc5464)
/// for details on metadata entry organization.
/// Wraps an ``AttributeFlag`` as an entry name in the `/flags/` namespace:
/// ```
/// entry-flag-name = DQUOTE "/flags/" attr-flag DQUOTE
/// ```
///
/// ### Example
///
/// ```
/// C: A001 GETMETADATA "INBOX" DEPTH 0 ("/flags/\\Seen")
/// S: * METADATA "INBOX" ("/flags/\\Seen" "12345")
/// S: A001 OK GETMETADATA completed
/// C: a SEARCH MODSEQ "/flags/\\draft" all 620162338
/// S: * SEARCH 2 5 6 7 11 12 18 19 20 23 (MODSEQ 917162500)
/// S: a OK Search complete
/// ```
///
/// The entry name `/flags/\Seen` is represented using ``EntryFlagName`` wrapping the
/// ``AttributeFlag`` for `\Seen`. The value `12345` is the modification sequence for that flag.
/// The entry name `"/flags/\\draft"` is an ``EntryFlagName`` wrapping the ``AttributeFlag`` `\draft`.
///
/// ## Related types
///
/// - See ``AttributeFlag`` for system flag representation
/// - See ``MetadataEntryName`` for general metadata entry names
/// - See ``SearchModificationSequence`` for flag modification sequences in search operations
/// - See ``AttributeFlag`` for the flag
/// - See ``EntryKindRequest`` for the `priv` / `shared` / `all` that follows
/// - See ``SearchModificationSequence`` for the `MODSEQ` criterion
///
/// - SeeAlso: [RFC 5464](https://datatracker.ietf.org/doc/html/rfc5464)
/// - SeeAlso: [RFC 7162 Section 3.1.5](https://datatracker.ietf.org/doc/html/rfc7162#section-3.1.5)
public struct EntryFlagName: Hashable, Sendable {
/// The flag wrapped as a metadata entry.
///
@@ -14,49 +14,43 @@
import struct NIO.ByteBuffer
/// Specifies which type of metadata entries to query in `GETMETADATA` commands (RFC 5464).
/// Which metadata items a `SEARCH MODSEQ` criterion considers (RFC 7162 `entry-type-req`).
///
/// **Requires server capability:** ``Capability/metadata`` or ``Capability/metadataServer``
/// **Requires server capability:** ``Capability/condStore``
///
/// Entry kind options determine whether metadata operations target private entries (visible only
/// to the authenticated user), shared entries (visible to all users), or both. This allows clients
/// to restrict metadata queries to specific visibility scopes. See [RFC 5464 Section 3.3](https://datatracker.ietf.org/doc/html/rfc5464#section-3.3).
/// A flag's modification sequence can be tracked separately for private (per-user) and shared
/// metadata items. This selects which of them the `MODSEQ` criterion compares against:
/// ```
/// entry-type-req = entry-type-resp / "all"
/// entry-type-resp = "priv" / "shared"
/// ```
///
/// ### Example
///
/// ```
/// C: A001 GETMETADATA (DEPTH 0) "INBOX" ALL ("/flags/\\Seen")
/// S: * METADATA "INBOX" ("/flags/\\Seen" "12345")
/// S: A001 OK GETMETADATA completed
/// C: a SEARCH MODSEQ "/flags/\\draft" all 620162338
/// S: * SEARCH 2 5 6 7 11 12 18 19 20 23 (MODSEQ 917162500)
/// S: a OK Search complete
/// ```
///
/// The `ALL` option in the command queries modification sequences for the specified flags,
/// considering both private and shared metadata sources.
/// `all` is ``EntryKindRequest/all``: the larger of the private and shared modification sequences.
///
/// ## Related types
///
/// - See ``EntryKindResponse`` for server-returned entry type information
/// - See ``MetadataOption`` for other metadata query options
/// - See ``EntryFlagName`` for flag entry names
/// - See ``EntryFlagName`` for the `"/flags/…"` entry name
/// - See ``SearchModificationSequence`` for the `MODSEQ` criterion
///
/// - SeeAlso: [RFC 5464 Section 3.3](https://datatracker.ietf.org/doc/html/rfc5464#section-3.3)
/// - SeeAlso: [RFC 7162 Section 3.1.5](https://datatracker.ietf.org/doc/html/rfc7162#section-3.1.5)
public struct EntryKindRequest: Hashable, Sendable {
fileprivate var backing: String
/// Search or retrieve private metadata items (visible only to the authenticated user).
///
/// Targets entries in the `/private/` namespace. From [RFC 5464 Section 3.3](https://datatracker.ietf.org/doc/html/rfc5464#section-3.3).
/// `priv`: private metadata items (visible only to the authenticated user).
public static let `private` = Self(backing: "priv")
/// Search or retrieve shared metadata items (visible to all users).
///
/// Targets entries in the `/shared/` namespace. From [RFC 5464 Section 3.3](https://datatracker.ietf.org/doc/html/rfc5464#section-3.3).
/// `shared`: shared metadata items (visible to all users).
public static let shared = Self(backing: "shared")
/// Search or retrieve both private and shared metadata items.
///
/// For modification sequence tracking, returns the largest modification sequence value
/// across both private and shared entry types. From [RFC 5464 Section 3.3](https://datatracker.ietf.org/doc/html/rfc5464#section-3.3).
/// `all`: both; the larger of the two modification sequences is used.
public static let all = Self(backing: "all")
}
@@ -14,46 +14,24 @@
import struct NIO.ByteBuffer
/// Describes the metadata item type returned by the server in metadata responses (RFC 5464).
/// The metadata item type of a flag's modification sequence (RFC 7162 `entry-type-resp`).
///
/// **Requires server capability:** ``Capability/metadata`` or ``Capability/metadataServer``
///
/// Entry kind response indicates whether a metadata entry belongs to the private namespace
/// (visible only to the authenticated user) or the shared namespace (visible to all users).
/// The server returns this information when responding to metadata queries.
/// See [RFC 5464 Section 3.3](https://datatracker.ietf.org/doc/html/rfc5464#section-3.3).
///
/// ### Example
/// **Requires server capability:** ``Capability/condStore``
///
/// ```
/// C: A001 GETMETADATA "INBOX" ("/flags/\\Seen")
/// S: * METADATA "INBOX" (priv "/flags/\\Seen" "12345")
/// S: A001 OK GETMETADATA completed
/// entry-type-resp = "priv" / "shared"
/// ```
///
/// The response includes the entry type `priv` to indicate that the `/flags/\Seen` modification
/// sequence metadata is private to the authenticated user.
/// - See ``EntryKindRequest``, which adds `all`
///
/// ## Related types
///
/// - See ``EntryKindRequest`` for client-side entry type specification
/// - See ``MetadataResponse`` for complete metadata responses
/// - See ``EntryFlagName`` for flag entry names
///
/// - SeeAlso: [RFC 5464 Section 3.3](https://datatracker.ietf.org/doc/html/rfc5464#section-3.3)
/// - SeeAlso: [RFC 7162 Section 3.1.5](https://datatracker.ietf.org/doc/html/rfc7162#section-3.1.5)
public struct EntryKindResponse: Hashable, Sendable {
fileprivate var backing: String
/// Private metadata item type (visible only to the authenticated user).
///
/// Indicates that the metadata entry is in the `/private/` namespace and is not visible
/// to other users. From [RFC 5464 Section 3.3](https://datatracker.ietf.org/doc/html/rfc5464#section-3.3).
/// `priv`: private metadata items (visible only to the authenticated user).
public static let `private` = Self(backing: "priv")
/// Shared metadata item type (visible to all users).
///
/// Indicates that the metadata entry is in the `/shared/` namespace and is visible
/// to any user with access to the mailbox. From [RFC 5464 Section 3.3](https://datatracker.ietf.org/doc/html/rfc5464#section-3.3).
/// `shared`: shared metadata items (visible to all users).
public static let shared = Self(backing: "shared")
}
@@ -42,10 +42,11 @@ import struct OrderedCollections.OrderedDictionary
/// - SeeAlso: ``SearchKey``
/// - SeeAlso: ``ModificationSequenceValue``
public struct SearchModificationSequence: Hashable, Sendable {
/// Extension-specific entry attributes for future CONDSTORE enhancements.
/// The flag whose modification sequence to test, and which metadata items to consider:
/// `search-modseq-ext = SP entry-name SP entry-type-req`. Empty tests the message's
/// modification sequence.
///
/// May contain additional entry attributes defined by future IMAP extensions.
/// For basic MODSEQ searches (RFC 7162), this is typically empty.
/// RFC 7162 allows at most one entry.
public var extensions: OrderedDictionary<EntryFlagName, EntryKindRequest>
/// The minimum modification sequence value that matching messages must have.
@@ -54,7 +55,7 @@ public struct SearchModificationSequence: Hashable, Sendable {
public var sequenceValue: ModificationSequenceValue
/// Creates a new `SearchModificationSequence`.
/// - parameter extensions: Extension-specific entry attributes (typically empty for RFC 7162)
/// - parameter extensions: The flag and metadata item type to test; at most one, usually empty
/// - parameter sequenceValue: The minimum modification sequence value to match
public init(
extensions: OrderedDictionary<EntryFlagName, EntryKindRequest>,