mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-15 17:51:10 +00:00
Ignore incoming presence updates when presence is disabled (#7508)
This commit is contained in:
parent
56b66db78a
commit
02d97fc3ba
2 changed files with 5 additions and 2 deletions
1
changelog.d/7508.bugfix
Normal file
1
changelog.d/7508.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Ignore incoming presence events from other homeservers if presence is disabled locally.
|
|
@ -204,6 +204,7 @@ class PresenceHandler(BasePresenceHandler):
|
||||||
self.notifier = hs.get_notifier()
|
self.notifier = hs.get_notifier()
|
||||||
self.federation = hs.get_federation_sender()
|
self.federation = hs.get_federation_sender()
|
||||||
self.state = hs.get_state_handler()
|
self.state = hs.get_state_handler()
|
||||||
|
self._presence_enabled = hs.config.use_presence
|
||||||
|
|
||||||
federation_registry = hs.get_federation_registry()
|
federation_registry = hs.get_federation_registry()
|
||||||
|
|
||||||
|
@ -676,13 +677,14 @@ class PresenceHandler(BasePresenceHandler):
|
||||||
async def incoming_presence(self, origin, content):
|
async def incoming_presence(self, origin, content):
|
||||||
"""Called when we receive a `m.presence` EDU from a remote server.
|
"""Called when we receive a `m.presence` EDU from a remote server.
|
||||||
"""
|
"""
|
||||||
|
if not self._presence_enabled:
|
||||||
|
return
|
||||||
|
|
||||||
now = self.clock.time_msec()
|
now = self.clock.time_msec()
|
||||||
updates = []
|
updates = []
|
||||||
for push in content.get("push", []):
|
for push in content.get("push", []):
|
||||||
# A "push" contains a list of presence that we are probably interested
|
# A "push" contains a list of presence that we are probably interested
|
||||||
# in.
|
# in.
|
||||||
# TODO: Actually check if we're interested, rather than blindly
|
|
||||||
# accepting presence updates.
|
|
||||||
user_id = push.get("user_id", None)
|
user_id = push.get("user_id", None)
|
||||||
if not user_id:
|
if not user_id:
|
||||||
logger.info(
|
logger.info(
|
||||||
|
|
Loading…
Reference in a new issue