buffer: Update the buffer name after a room name event in the state.
This commit is contained in:
parent
6422381ae5
commit
aae5732018
2 changed files with 8 additions and 4 deletions
|
@ -962,6 +962,9 @@ class RoomBuffer(object):
|
||||||
self.weechat_buffer.invite(event.state_key, date)
|
self.weechat_buffer.invite(event.state_key, date)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
self.update_buffer_name()
|
||||||
|
|
||||||
|
def update_buffer_name(self):
|
||||||
room_name = self.room.display_name()
|
room_name = self.room.display_name()
|
||||||
self.weechat_buffer.short_name = room_name
|
self.weechat_buffer.short_name = room_name
|
||||||
|
|
||||||
|
@ -1099,6 +1102,8 @@ class RoomBuffer(object):
|
||||||
self._handle_topic(event, True)
|
self._handle_topic(event, True)
|
||||||
elif isinstance(event, PowerLevelsEvent):
|
elif isinstance(event, PowerLevelsEvent):
|
||||||
self._handle_power_level(event)
|
self._handle_power_level(event)
|
||||||
|
elif isinstance(event, (RoomNameEvent, RoomAliasEvent)):
|
||||||
|
self.update_buffer_name()
|
||||||
elif isinstance(event, RoomEncryptionEvent):
|
elif isinstance(event, RoomEncryptionEvent):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -1154,8 +1159,7 @@ class RoomBuffer(object):
|
||||||
self.handle_membership_events(event, False)
|
self.handle_membership_events(event, False)
|
||||||
|
|
||||||
elif isinstance(event, (RoomNameEvent, RoomAliasEvent)):
|
elif isinstance(event, (RoomNameEvent, RoomAliasEvent)):
|
||||||
room_name = self.room.display_name()
|
self.update_buffer_name()
|
||||||
self.weechat_buffer.short_name = room_name
|
|
||||||
|
|
||||||
elif isinstance(event, RoomTopicEvent):
|
elif isinstance(event, RoomTopicEvent):
|
||||||
self._handle_topic(event, False)
|
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
|
# We didn't handle all joined users, the room display name might still
|
||||||
# be outdated because of that, update it now.
|
# be outdated because of that, update it now.
|
||||||
if self.unhandled_users:
|
if self.unhandled_users:
|
||||||
room_name = self.room.display_name()
|
self.update_buffer_name()
|
||||||
self.weechat_buffer.short_name = room_name
|
|
||||||
|
|
||||||
def handle_left_room(self, info):
|
def handle_left_room(self, info):
|
||||||
self.joined = False
|
self.joined = False
|
||||||
|
|
|
@ -1094,6 +1094,7 @@ class MatrixServer(object):
|
||||||
room_buffer.unhandled_users += users
|
room_buffer.unhandled_users += users
|
||||||
self._hook_lazy_user_adding()
|
self._hook_lazy_user_adding()
|
||||||
room_buffer.members_fetched = True
|
room_buffer.members_fetched = True
|
||||||
|
room_buffer.update_buffer_name()
|
||||||
|
|
||||||
# Fetch the users for the next room.
|
# Fetch the users for the next room.
|
||||||
if self.rooms_with_missing_members:
|
if self.rooms_with_missing_members:
|
||||||
|
|
Loading…
Add table
Reference in a new issue