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.
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.
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.
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.
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.