Skip to main content

unread_counts

Function unread_counts 

Source
pub async fn unread_counts() -> Result<HashMap<String, u32>, String>
Expand description

Per-chat unread count, computed straight from the DB so it’s correct even when only the last message is in RAM (the boot state). Mirrors the in-memory walk-back exactly: unread = non-mine messages newer than the most recent “anchor” (our own message OR the last_read marker, whichever is latest). A never-read chat (empty last_read, no own message) counts all its non-mine messages. Returns chat_identifier → count; chats with 0 unread are omitted. Muted/blocked filtering is left to the caller (it lives in RAM state, cheaply).