Table of Contents

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

accountId MailAccountId

The account whose mutations are read.

folderResolutionId MailFolderResolutionId

The alias binding the occurrences were stored under.

uidValidity ImapUidValidity

The UIDVALIDITY the window was opened for.

uids IReadOnlyCollection<ImapUid>

The UIDs whose remote \Seen flag the window found standing somewhere new.

cancellationToken CancellationToken

Cancels the read.

Returns

Task<IReadOnlyList<MailboxMutationRecord>>

Every \Seen store 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 uids is null.