Fix typing status parsing

Co-authored-by: Tulir Asokan <tulir@maunium.net>
This commit is contained in:
Mads Marquart
2020-01-05 19:52:59 +01:00
parent afad38d8e1
commit e488f4a7da

View File

@@ -2741,19 +2741,13 @@ class Client(object):
) )
# Typing # Typing
elif topic in ["typ", "ttyp"]: elif topic in ("/thread_typing", "/orca_typing_notifications"):
author_id = str(m.get("from")) author_id = str(m["sender_fbid"])
thread_id = m.get("thread_fbid") thread_id = m.get("thread", author_id)
if thread_id: typing_status = TypingStatus(m.get("state"))
thread_type = ThreadType.GROUP thread_type = (
thread_id = str(thread_id) ThreadType.USER if thread_id == author_id else ThreadType.GROUP
else: )
thread_type = ThreadType.USER
if author_id == self._uid:
thread_id = m.get("to")
else:
thread_id = author_id
typing_status = TypingStatus(m.get("st"))
self.onTyping( self.onTyping(
author_id=author_id, author_id=author_id,
status=typing_status, status=typing_status,