From eab12eed086107857efd3803082ebddf1f98d357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Mon, 3 Sep 2018 20:39:44 +0200 Subject: [PATCH] buffer: Use a property to update bar items. --- matrix/buffer.py | 12 ++++++++++-- matrix/server.py | 1 - 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/matrix/buffer.py b/matrix/buffer.py index 630bcce..379a5dc 100644 --- a/matrix/buffer.py +++ b/matrix/buffer.py @@ -757,7 +757,7 @@ class WeechatChannelBuffer(object): class RoomBuffer(object): def __init__(self, room, server_name, prev_batch): self.room = room - self.backlog_pending = False + self._backlog_pending = False self.prev_batch = prev_batch self.joined = True self.leave_event_id = None # type: Optional[str] @@ -772,6 +772,15 @@ class RoomBuffer(object): 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): # type: (str) -> str """Find a suitable nick from a user_id""" @@ -1200,7 +1209,6 @@ class RoomBuffer(object): self.sort_messages() self.backlog_pending = False - W.bar_item_update("buffer_modes") def handle_joined_room(self, info): for event in info.state: diff --git a/matrix/server.py b/matrix/server.py index cfbdc94..8fde82b 100644 --- a/matrix/server.py +++ b/matrix/server.py @@ -599,7 +599,6 @@ class MatrixServer(object): limit=10) room_buffer.backlog_pending = True - W.bar_item_update("buffer_modes") self.backlog_queue[uuid] = room_id self.send_or_queue(request)