Skip to main content

Module chats

Module chats 

Source
Expand description

Chat database operations — CRUD for the chats table.

Structs§

SlimChatDB
Slim version of Chat for database storage.

Functions§

clear_chat_last_read
Upsert a chat to the database. Clear a chat’s read marker to never-read. The save_slim_chat upsert deliberately refuses to regress last_read to empty (a partially-hydrated STATE chat would otherwise wipe the stored position), so a DELIBERATE clear — Mark as Unread on a chat whose only message is the target — must come through here or it silently no-ops.
delete_chat
Delete a chat and all its messages from the database. chat_identifier is the string id (npub for DMs, channel id for Communities) — NOT the integer PK.
get_all_chats
Get all chats from the database.
save_slim_chat