mirror of
https://github.com/element-hq/synapse.git
synced 2025-03-06 16:06:52 +00:00
Only send presence updates to remote hosts if user is ours
This commit is contained in:
parent
24d9f2c140
commit
42ac5f0c1a
1 changed files with 10 additions and 2 deletions
|
@ -428,13 +428,21 @@ class PresenceHandler(BaseHandler):
|
||||||
|
|
||||||
hosts_to_states = {}
|
hosts_to_states = {}
|
||||||
for room_id, states in room_ids_to_states.items():
|
for room_id, states in room_ids_to_states.items():
|
||||||
|
local_states = filter(self.hs.is_mine_id, states)
|
||||||
|
if not local_states:
|
||||||
|
continue
|
||||||
|
|
||||||
hosts = yield self.store.get_joined_hosts_for_room(room_id)
|
hosts = yield self.store.get_joined_hosts_for_room(room_id)
|
||||||
for host in hosts:
|
for host in hosts:
|
||||||
hosts_to_states.setdefault(host, []).extend(states)
|
hosts_to_states.setdefault(host, []).extend(local_states)
|
||||||
|
|
||||||
for user_id, states in users_to_states.items():
|
for user_id, states in users_to_states.items():
|
||||||
|
local_states = filter(self.hs.is_mine_id, states)
|
||||||
|
if not local_states:
|
||||||
|
continue
|
||||||
|
|
||||||
host = UserID.from_string(user_id).domain
|
host = UserID.from_string(user_id).domain
|
||||||
hosts_to_states.setdefault(host, []).extend(states)
|
hosts_to_states.setdefault(host, []).extend(local_states)
|
||||||
|
|
||||||
# TODO: de-dup hosts_to_states, as a single host might have multiple
|
# TODO: de-dup hosts_to_states, as a single host might have multiple
|
||||||
# of same presence
|
# of same presence
|
||||||
|
|
Loading…
Add table
Reference in a new issue