buffer: Use a property to update bar items.

This commit is contained in:
Damir Jelić 2018-09-03 20:39:44 +02:00
parent dc8df67f55
commit eab12eed08
2 changed files with 10 additions and 3 deletions

View file

@ -757,7 +757,7 @@ class WeechatChannelBuffer(object):
class RoomBuffer(object): class RoomBuffer(object):
def __init__(self, room, server_name, prev_batch): def __init__(self, room, server_name, prev_batch):
self.room = room self.room = room
self.backlog_pending = False self._backlog_pending = False
self.prev_batch = prev_batch self.prev_batch = prev_batch
self.joined = True self.joined = True
self.leave_event_id = None # type: Optional[str] self.leave_event_id = None # type: Optional[str]
@ -772,6 +772,15 @@ class RoomBuffer(object):
buffer_name, server_name, user buffer_name, server_name, user
) )
@property
def backlog_pending(self):
return self._backlog_pending
@backlog_pending.setter
def backlog_pending(self, value):
self._backlog_pending = value
W.bar_item_update("buffer_modes")
def find_nick(self, user_id): def find_nick(self, user_id):
# type: (str) -> str # type: (str) -> str
"""Find a suitable nick from a user_id""" """Find a suitable nick from a user_id"""
@ -1200,7 +1209,6 @@ class RoomBuffer(object):
self.sort_messages() self.sort_messages()
self.backlog_pending = False self.backlog_pending = False
W.bar_item_update("buffer_modes")
def handle_joined_room(self, info): def handle_joined_room(self, info):
for event in info.state: for event in info.state:

View file

@ -599,7 +599,6 @@ class MatrixServer(object):
limit=10) limit=10)
room_buffer.backlog_pending = True room_buffer.backlog_pending = True
W.bar_item_update("buffer_modes")
self.backlog_queue[uuid] = room_id self.backlog_queue[uuid] = room_id
self.send_or_queue(request) self.send_or_queue(request)