summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <paul@matrix.org>2014-12-11 18:33:09 +0000
committerPaul "LeoNerd" Evans <paul@matrix.org>2014-12-11 18:33:09 +0000
commitcfb963af0376a02fa527c458530d08c92893d21a (patch)
treea34fc3592c2111f0c77eda61ab14b3b9f302a8fb /synapse/handlers
parentAdd a 'user_left_room' distributor signal analogous to 'user_joined_room' (diff)
downloadsynapse-cfb963af0376a02fa527c458530d08c92893d21a.tar.xz
When users leave rooms mark them as no longer typing in them
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/typing.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/synapse/handlers/typing.py b/synapse/handlers/typing.py
index fa903c251c..46a0b299a1 100644
--- a/synapse/handlers/typing.py
+++ b/synapse/handlers/typing.py
@@ -43,6 +43,8 @@ class TypingNotificationHandler(BaseHandler):
 
         self.federation.register_edu_handler("m.typing", self._recv_edu)
 
+        hs.get_distributor().observe("user_left_room", self.user_left_room)
+
         self._member_typing_until = {} # clock time we expect to stop
         self._member_typing_timer = {} # deferreds to manage theabove
 
@@ -115,6 +117,12 @@ class TypingNotificationHandler(BaseHandler):
         yield self._stopped_typing(member)
 
     @defer.inlineCallbacks
+    def user_left_room(self, user, room_id):
+        if user.is_mine:
+            member = RoomMember(room_id=room_id, user=user)
+            yield self._stopped_typing(member)
+
+    @defer.inlineCallbacks
     def _stopped_typing(self, member):
         if member not in self._member_typing_until:
             # No point