Class RemoteEmailKeywords
- Namespace
- MailFathom.Domain.Emails
- Assembly
- MailFathom.Domain.dll
Holds the keywords a mail server reported for one email, in the one form everything compares them in.
public sealed record RemoteEmailKeywords : IEquatable<RemoteEmailKeywords>
- Inheritance
-
RemoteEmailKeywords
- Implements
- Inherited Members
Remarks
A keyword is a flag the IMAP specification leaves to whoever set it — $Junk, $Forwarded, a mail client's
own label — as opposed to the five system flags RemoteEmailFlagSnapshot carries as booleans. There is
no vocabulary to validate against, so this type decides nothing about what a keyword means and only about what makes
two of them the same one and how many of them a message may bring with it.
RFC 9051 states that flag names are compared without regard to case, so the same keyword written two ways is one
keyword and is held here in one case. MailKit reports what the server wrote instead, octet for octet, which is why
the folding happens on the way in rather than being left to whoever compares: an unfolded set would store
$Junk and $junk as two values, and a filter matching one of them would miss mail carrying the other.
The case is upper, which is the comparison form NormalizedAddress and
MailFolderAlias already publish, so nothing here is a second answer to what folding means.
The kept keywords are ordered and deduplicated, which makes the value a set rather than a reading of one. Two observations that found the same keywords therefore produce equal values whatever order the server listed them in, and the stored mirror stops being rewritten by a server that reorders its own answer.
Fields
- MaximumKeywordLength
The greatest number of characters one keyword may carry.
- MaximumKeywords
The greatest number of keywords one email keeps.
Properties
- None
Gets the keywords of an email that carries none, which is also what an unobserved email carries.
- Values
Gets the keywords, folded to upper case, without duplicates, in ordinal order.
Methods
- Create(IEnumerable<string>?)
Builds the keyword set from what a server reported.
- Equals(RemoteEmailKeywords?)
Reports whether two keyword sets hold the same keywords.
- GetHashCode()
Serves as the default hash function.
- Normalized(string?)
Reduces one written keyword to the form everything compares keywords in.