From aec7023e25d90a31962dba73013d35d978038378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 10 Sep 2019 23:23:57 +0200 Subject: [PATCH] buffer: Force member loading if we're printing from the backlog as well. --- matrix/buffer.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/matrix/buffer.py b/matrix/buffer.py index 3c7681f..921b6b2 100644 --- a/matrix/buffer.py +++ b/matrix/buffer.py @@ -1429,19 +1429,22 @@ class RoomBuffer(object): elif isinstance(event, MegolmEvent): self.print_megolm(event, extra_tags) + def force_load_member(self, event): + if (event.sender not in self.displayed_nicks and + event.sender in self.room.users): + + try: + self.unhandled_users.remove(event.sender) + except ValueError: + pass + + self.add_user(event.sender, 0, True, True) + def handle_timeline_event(self, event, extra_tags=None): # TODO this should be done for every messagetype that gets printed in # the buffer if isinstance(event, (RoomMessage, MegolmEvent)): - if (event.sender not in self.displayed_nicks and - event.sender in self.room.users): - - try: - self.unhandled_users.remove(event.sender) - except ValueError: - pass - - self.add_user(event.sender, 0, True, True) + self.force_load_member(event) if event.transaction_id: self.handle_own_message_in_timeline(event) @@ -1635,6 +1638,7 @@ class RoomBuffer(object): # messing up the room state the state change will need to be separated # from the print logic. if isinstance(event, RoomMessage): + self.force_load_member(event) self.handle_room_messages(event, tags) elif isinstance(event, MegolmEvent):