generated from Nodarx/template
feat: harmonize mailbox messages
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user