mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-07-31 21:38:37 -04:00
Clobber EDUs in send queue
This commit is contained in:
parent
ab80d5e0a9
commit
52b2318777
5 changed files with 58 additions and 20 deletions
|
@ -625,18 +625,8 @@ class PresenceHandler(object):
|
|||
Args:
|
||||
hosts_to_states (dict): Mapping `server_name` -> `[UserPresenceState]`
|
||||
"""
|
||||
now = self.clock.time_msec()
|
||||
for host, states in hosts_to_states.items():
|
||||
self.federation.send_edu(
|
||||
destination=host,
|
||||
edu_type="m.presence",
|
||||
content={
|
||||
"push": [
|
||||
_format_user_presence_state(state, now)
|
||||
for state in states
|
||||
]
|
||||
}
|
||||
)
|
||||
self.federation.send_presence(host, states)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def incoming_presence(self, origin, content):
|
||||
|
@ -723,13 +713,13 @@ class PresenceHandler(object):
|
|||
defer.returnValue([
|
||||
{
|
||||
"type": "m.presence",
|
||||
"content": _format_user_presence_state(state, now),
|
||||
"content": format_user_presence_state(state, now),
|
||||
}
|
||||
for state in updates
|
||||
])
|
||||
else:
|
||||
defer.returnValue([
|
||||
_format_user_presence_state(state, now) for state in updates
|
||||
format_user_presence_state(state, now) for state in updates
|
||||
])
|
||||
|
||||
@defer.inlineCallbacks
|
||||
|
@ -988,7 +978,7 @@ def should_notify(old_state, new_state):
|
|||
return False
|
||||
|
||||
|
||||
def _format_user_presence_state(state, now):
|
||||
def format_user_presence_state(state, now):
|
||||
"""Convert UserPresenceState to a format that can be sent down to clients
|
||||
and to other servers.
|
||||
"""
|
||||
|
@ -1101,7 +1091,7 @@ class PresenceEventSource(object):
|
|||
defer.returnValue(([
|
||||
{
|
||||
"type": "m.presence",
|
||||
"content": _format_user_presence_state(s, now),
|
||||
"content": format_user_presence_state(s, now),
|
||||
}
|
||||
for s in updates.values()
|
||||
if include_offline or s.state != PresenceState.OFFLINE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue