buffer: Force member loading if we're printing from the backlog as well.

This commit is contained in:
Damir Jelić 2019-09-10 23:23:57 +02:00
parent 0acd3d7dc9
commit aec7023e25

View file

@ -1429,19 +1429,22 @@ class RoomBuffer(object):
elif isinstance(event, MegolmEvent): elif isinstance(event, MegolmEvent):
self.print_megolm(event, extra_tags) 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): def handle_timeline_event(self, event, extra_tags=None):
# TODO this should be done for every messagetype that gets printed in # TODO this should be done for every messagetype that gets printed in
# the buffer # the buffer
if isinstance(event, (RoomMessage, MegolmEvent)): if isinstance(event, (RoomMessage, MegolmEvent)):
if (event.sender not in self.displayed_nicks and self.force_load_member(event)
event.sender in self.room.users):
try:
self.unhandled_users.remove(event.sender)
except ValueError:
pass
self.add_user(event.sender, 0, True, True)
if event.transaction_id: if event.transaction_id:
self.handle_own_message_in_timeline(event) 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 # messing up the room state the state change will need to be separated
# from the print logic. # from the print logic.
if isinstance(event, RoomMessage): if isinstance(event, RoomMessage):
self.force_load_member(event)
self.handle_room_messages(event, tags) self.handle_room_messages(event, tags)
elif isinstance(event, MegolmEvent): elif isinstance(event, MegolmEvent):