Method ReadSeenStateChangesOnAsync
- Namespace
- MailFathom.Application.Mail.Mutations
- Assembly
- MailFathom.Application.dll
ReadSeenStateChangesOnAsync(MailAccountId, MailFolderResolutionId, ImapUidValidity, IReadOnlyCollection<ImapUid>, CancellationToken)
Reads the \Seen stores issued against any of the occurrences a reconciliation window read flags for.
Task<IReadOnlyList<MailboxMutationRecord>> ReadSeenStateChangesOnAsync(MailAccountId accountId, MailFolderResolutionId folderResolutionId, ImapUidValidity uidValidity, IReadOnlyCollection<ImapUid> uids, CancellationToken cancellationToken)
Parameters
accountIdMailAccountIdThe account whose mutations are read.
folderResolutionIdMailFolderResolutionIdThe alias binding the occurrences were stored under.
uidValidityImapUidValidityThe UIDVALIDITY the window was opened for.
uidsIReadOnlyCollection<ImapUid>The UIDs whose remote
\Seenflag the window found standing somewhere new.cancellationTokenCancellationTokenCancels the read.
Returns
- Task<IReadOnlyList<MailboxMutationRecord>>
Every
\Seenstore issued against one of those occurrences, which may be none.
Remarks
This is the read the whole issue turns on. A flag change reaches synchronization as a changed modification sequence, which is exactly what a person marking mail read in their own client produces, so nothing in the server's answer distinguishes the two and only the record does. A rule conditioned on unread mail that marks mail read would otherwise re-evaluate every message it had just acted on.
Only the occurrences whose flag actually moved are asked about, so a window that found the mailbox unchanged —
which is most windows — asks nothing. The answer is bounded by uids and by the idempotency
identity, which admits one record per occurrence, requester, and mutation.
Every such record is returned, spent or not, because whether one still accounts for anything is settled against the occurrence's own last observation rather than against a mark on the row. That comparison belongs to AccountsForSeenStateOf(EmailOccurrenceId, bool, DateTimeOffset), which the caller applies to what this returns.
Exceptions
- ArgumentNullException
Thrown when
uidsis null.