When users leave rooms mark them as no longer typing in them
This commit is contained in:
parent
f25764943c
commit
cfb963af03
|
@ -43,6 +43,8 @@ class TypingNotificationHandler(BaseHandler):
|
||||||
|
|
||||||
self.federation.register_edu_handler("m.typing", self._recv_edu)
|
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_until = {} # clock time we expect to stop
|
||||||
self._member_typing_timer = {} # deferreds to manage theabove
|
self._member_typing_timer = {} # deferreds to manage theabove
|
||||||
|
|
||||||
|
@ -114,6 +116,12 @@ class TypingNotificationHandler(BaseHandler):
|
||||||
|
|
||||||
yield self._stopped_typing(member)
|
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
|
@defer.inlineCallbacks
|
||||||
def _stopped_typing(self, member):
|
def _stopped_typing(self, member):
|
||||||
if member not in self._member_typing_until:
|
if member not in self._member_typing_until:
|
||||||
|
|
Loading…
Reference in New Issue