feat: harmonize mailbox messages

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-10-05 20:34:02 -04:00
parent b02ca63208
commit 65fdb23fa4
12 changed files with 879 additions and 43 deletions
+19
View File
@@ -145,6 +145,25 @@ class MessageStore
return $uids;
}
/**
* List the flags of every message cached for a mailbox.
*
* @return array<int, list<string>> set flags keyed by UID
*/
public function flags(string $serviceId, string $mailbox, int $uidValidity): array
{
$cursor = $this->dataStore->selectCollection(self::COLLECTION_NAME)->find(
['sid' => $serviceId, 'mailbox' => $mailbox, 'uidValidity' => $uidValidity],
['projection' => ['uid' => 1, 'flags' => 1]],
);
$flags = [];
foreach ($cursor as $document) {
$flags[(int) $document['uid']] = array_values(array_map('strval', (array) ($document['flags'] ?? [])));
}
return $flags;
}
/**
* Replace the flags of a message.
*