matrix-org / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://matrix-org.github.io/synapse
Apache License 2.0
11.83k stars 2.13k forks source link

Add a new module API to update user presence state. #16544

Closed clokep closed 1 year ago

clokep commented 1 year ago

This adds a module API which allows a module to update a user's presence state/status message. This is useful for controlling presence from an external system.

To fully control presence from the module the presence.enabled config parameter gains a new state of "untracked" which disables internal tracking of presence changes via user actions, etc. Only updates from the module will be persisted and sent down sync properly).

DMRobertson commented 1 year ago

Changes made via the module API persist until an additional change is made (either via the module API, or via a user setting it directly).

So to check, there are now three ways to alter presence state:

  1. Module API
  2. User directly setting their presence
  3. Implicitly setting presence via user activity

Am I right that (1) persists indefinitely until it is replaced, but (2) and (3) expire thanks to this wheel timer thing?

clokep commented 1 year ago

Am I right that (1) persists indefinitely until it is replaced, but (2) and (3) expire thanks to this wheel timer thing?

Yes; there's a 4th way too -- which is a EDU received from a remote server. (This is analogous to (2) though and also times out, but in a slightly different way.)