feat: implement optional support for MSC4495 (Selective Presence) #2034

Open
thetayloredman wants to merge 11 commits from thetayloredman/continuwuity:presence-v2/msc4495 into main

11 commits

Author SHA1 Message Date
4bb690ecd9
chore: address CI failure and code review comment
All checks were successful
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Check changed files (pull_request) Successful in 5s
Checks / Changelog / Check changelog is added (pull_request_target) Successful in 6s
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 1m12s
Update flake hashes / update-flake-hashes (pull_request) Successful in 1m10s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 8m30s
2026-07-27 20:45:04 -07:00
8fa7eaaa0a
chore: add changelog fragment 2026-07-27 20:45:04 -07:00
275531f00b
feat: handle outbound Selective Presence
This commit moves responsibility for sending presence EDUs out of the
sender's `select_edus_presence` function, and instead to a push approach
from the presence module. Upon `set_presence` for a local user, the presence
module calculates the user's recipient set (if selective presence is enabled)
and then applies that information to outbound presence EDUs.
2026-07-27 20:45:03 -07:00
311fadde1f
feat: use presence recipient lists to restrict presence access
This commit applies recipient lists as access control to presence down `/sync`
and the `/client/users/{userId}/status` endpoint.
2026-07-27 20:45:03 -07:00
0f9c552fb2
feat: handle presence recipients on inbound EDUs 2026-07-27 20:45:03 -07:00
3b927bcb77
feat: add presence sharing hint to room creation template 2026-07-27 20:45:02 -07:00
4efb880eb9
feat: add MSC4495 /query/presence_recipients federation endpoint
Adds the `presence_recipients` federation query endpoint, used by remote
servers to query the recipients of a local user in the case of a break
in the stream of EDU updates.
2026-07-27 20:45:02 -07:00
183079740f
feat(admin): add admin commands for presence recipients
Adds `!admin debug recalculate-presence-recipients` and
`!admin query get-recipient-users`.
2026-07-27 20:45:01 -07:00
e0ad4f5f49
feat: add MSC4495 recipient user set calculation
This commit adds logic for MSC4495 to the presence module, specifically
calculating a user's desired recipient user set given their `m.presence.sharing`
account_data alongside hints in rooms they are a member of.
2026-07-27 20:45:01 -07:00
659e52216d
chore(database): add MSC4495 userid_recipients column and data model
This commit adds the MSC4495 `userid_recipients` column, along with
the `PresenceRecipients` type and utilities.

For local users, this stores the user's most recently sent presence
recipients stream, and all remote and local users in their recipients set.

For remote users, this stores all local users in the recipient set as of
the last received presence EDU.

Additionally, utility functions for calculating and applying updates
are added.
2026-07-27 20:44:58 -07:00
44a17cedaf
chore: add MSC4495 config option, make unstable feature optional
This commit adds the config option `enable_msc4495_selective_presence`,
which will allow server operators to toggle MSC4495 before it is merged
into the spec. As this proposal is likely to break people's workflow up
until clients adequately support it, this gate is enabled for now.

We also pave the framework for future optional MSCs, by allowing the
`unstable_features()` function to take in a `Config` instance. This is
also propagated to callsites where it is used for path building by Ruma.
2026-07-27 17:47:50 -07:00