summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-02-18 09:11:42 +0000
committerErik Johnston <erik@matrix.org>2016-02-18 09:11:53 +0000
commitddca9c56fccfb03653986b36fe6cd11cf57328dc (patch)
treeeba61c46e4fa0801d03359cd631f97f0d4ed0afd /synapse
parentComment (diff)
downloadsynapse-ddca9c56fccfb03653986b36fe6cd11cf57328dc.tar.xz
Move if statement
Diffstat (limited to '')
-rw-r--r--synapse/handlers/presence.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py
index 3b01e9a072..1942e2ad30 100644
--- a/synapse/handlers/presence.py
+++ b/synapse/handlers/presence.py
@@ -298,10 +298,11 @@ class PresenceHandler(BaseHandler):
             if not state:
                 continue
 
-            if self.hs.is_mine_id(user_id):
-                if state.state == PresenceState.OFFLINE:
-                    continue
+            if state.state == PresenceState.OFFLINE:
+                # No timeouts are associated with offline states.
+                continue
 
+            if self.hs.is_mine_id(user_id):
                 if state.state == PresenceState.ONLINE:
                     if now - state.last_active > IDLE_TIMER:
                         # Currently online, but last activity ages ago so auto
@@ -331,11 +332,10 @@ class PresenceHandler(BaseHandler):
                 # This is to protect against forgetful/buggy servers, so that
                 # no one gets stuck online forever.
                 if now - state.last_federation_update > FEDERATION_TIMEOUT:
-                    if state.state != PresenceState.OFFLINE:
-                        # The other side seems to have disappeared.
-                        changes[user_id] = state.copy_and_replace(
-                            state=PresenceState.OFFLINE,
-                        )
+                    # The other side seems to have disappeared.
+                    changes[user_id] = state.copy_and_replace(
+                        state=PresenceState.OFFLINE,
+                    )
 
         preserve_fn(self._update_states)(changes.values())