summary refs log tree commit diff
path: root/synapse/handlers/typing.py
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2015-01-22 17:46:16 +0000
committerDavid Baker <dave@matrix.org>2015-01-22 17:46:16 +0000
commit5c6189ea3eb36409c57cd269a8931dda8f30e6ec (patch)
tree6a6217c76e23359e2edcebd1020b4807f18b3073 /synapse/handlers/typing.py
parentOops: second part of commit dc938606 (diff)
parentMerge pull request #30 from matrix-org/client_api_restructure (diff)
downloadsynapse-5c6189ea3eb36409c57cd269a8931dda8f30e6ec.tar.xz
Merge branch 'develop' into pushers
Conflicts:
	synapse/rest/__init__.py
Diffstat (limited to 'synapse/handlers/typing.py')
-rw-r--r--synapse/handlers/typing.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/synapse/handlers/typing.py b/synapse/handlers/typing.py
index 22ce7873d0..cd9638dd04 100644
--- a/synapse/handlers/typing.py
+++ b/synapse/handlers/typing.py
@@ -120,6 +120,10 @@ class TypingNotificationHandler(BaseHandler):
 
         member = RoomMember(room_id=room_id, user=target_user)
 
+        if member in self._member_typing_timer:
+            self.clock.cancel_call_later(self._member_typing_timer[member])
+            del self._member_typing_timer[member]
+
         yield self._stopped_typing(member)
 
     @defer.inlineCallbacks
@@ -142,8 +146,10 @@ class TypingNotificationHandler(BaseHandler):
 
         del self._member_typing_until[member]
 
-        self.clock.cancel_call_later(self._member_typing_timer[member])
-        del self._member_typing_timer[member]
+        if member in self._member_typing_timer:
+            # Don't cancel it - either it already expired, or the real
+            # stopped_typing() will cancel it
+            del self._member_typing_timer[member]
 
     @defer.inlineCallbacks
     def _push_update(self, room_id, user, typing):