/** * [Gitea #283] Do Not Disturb as a real presence state: MSC3026 "busy" * (Synapse `experimental_features.msc3026_enabled`). Before, DND was sent as * presence `unavailable` with the literal status text "dnd", which replaced * your status and showed as "dnd" in other clients. */ export const BUSY_PRESENCE = 'org.matrix.msc3026.busy'; export const BUSY_PRESENCE_FEATURE = 'org.matrix.msc3026.busy_presence'; let busySupported = false; /** Recorded by the presence updater from the server's unstable_features. */ export const setBusyPresenceSupported = (supported: boolean): void => { busySupported = supported; }; export const isBusyPresenceSupported = (): boolean => busySupported; /** Pure: whether a presence means Do Not Disturb (busy, or the legacy "dnd" text). */ export const isDndPresence = (presence: string | undefined, status: string | undefined): boolean => presence === BUSY_PRESENCE || (presence === 'unavailable' && status === 'dnd');