diff --git a/matrix/buffer.py b/matrix/buffer.py index 18de907..4d6c319 100644 --- a/matrix/buffer.py +++ b/matrix/buffer.py @@ -962,6 +962,9 @@ class RoomBuffer(object): self.weechat_buffer.invite(event.state_key, date) return + self.update_buffer_name() + + def update_buffer_name(self): room_name = self.room.display_name() self.weechat_buffer.short_name = room_name @@ -1099,6 +1102,8 @@ class RoomBuffer(object): self._handle_topic(event, True) elif isinstance(event, PowerLevelsEvent): self._handle_power_level(event) + elif isinstance(event, (RoomNameEvent, RoomAliasEvent)): + self.update_buffer_name() elif isinstance(event, RoomEncryptionEvent): pass @@ -1154,8 +1159,7 @@ class RoomBuffer(object): self.handle_membership_events(event, False) elif isinstance(event, (RoomNameEvent, RoomAliasEvent)): - room_name = self.room.display_name() - self.weechat_buffer.short_name = room_name + self.update_buffer_name() elif isinstance(event, RoomTopicEvent): self._handle_topic(event, False) @@ -1498,8 +1502,7 @@ class RoomBuffer(object): # We didn't handle all joined users, the room display name might still # be outdated because of that, update it now. if self.unhandled_users: - room_name = self.room.display_name() - self.weechat_buffer.short_name = room_name + self.update_buffer_name() def handle_left_room(self, info): self.joined = False diff --git a/matrix/server.py b/matrix/server.py index 178da3a..7fadc92 100644 --- a/matrix/server.py +++ b/matrix/server.py @@ -1094,6 +1094,7 @@ class MatrixServer(object): room_buffer.unhandled_users += users self._hook_lazy_user_adding() room_buffer.members_fetched = True + room_buffer.update_buffer_name() # Fetch the users for the next room. if self.rooms_with_missing_members: