Skip to content
Snippets Groups Projects
Commit ddca9c56 authored by Erik Johnston's avatar Erik Johnston
Browse files

Move if statement

parent 58371fa2
No related branches found
No related tags found
No related merge requests found
...@@ -298,10 +298,11 @@ class PresenceHandler(BaseHandler): ...@@ -298,10 +298,11 @@ class PresenceHandler(BaseHandler):
if not state: if not state:
continue continue
if self.hs.is_mine_id(user_id): if state.state == PresenceState.OFFLINE:
if state.state == PresenceState.OFFLINE: # No timeouts are associated with offline states.
continue continue
if self.hs.is_mine_id(user_id):
if state.state == PresenceState.ONLINE: if state.state == PresenceState.ONLINE:
if now - state.last_active > IDLE_TIMER: if now - state.last_active > IDLE_TIMER:
# Currently online, but last activity ages ago so auto # Currently online, but last activity ages ago so auto
...@@ -331,11 +332,10 @@ class PresenceHandler(BaseHandler): ...@@ -331,11 +332,10 @@ class PresenceHandler(BaseHandler):
# This is to protect against forgetful/buggy servers, so that # This is to protect against forgetful/buggy servers, so that
# no one gets stuck online forever. # no one gets stuck online forever.
if now - state.last_federation_update > FEDERATION_TIMEOUT: if now - state.last_federation_update > FEDERATION_TIMEOUT:
if state.state != PresenceState.OFFLINE: # The other side seems to have disappeared.
# The other side seems to have disappeared. changes[user_id] = state.copy_and_replace(
changes[user_id] = state.copy_and_replace( state=PresenceState.OFFLINE,
state=PresenceState.OFFLINE, )
)
preserve_fn(self._update_states)(changes.values()) preserve_fn(self._update_states)(changes.values())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment