server: Turn the connected flag into a property.
This way we update the necessary bar items automatically, when we change the flag.
This commit is contained in:
parent
25f4f43b3f
commit
92ff15943c
1 changed files with 11 additions and 1 deletions
|
@ -229,7 +229,7 @@ class MatrixServer(object):
|
||||||
self.timer_hook = None # type: Optional[str]
|
self.timer_hook = None # type: Optional[str]
|
||||||
self.numeric_address = "" # type: Optional[str]
|
self.numeric_address = "" # type: Optional[str]
|
||||||
|
|
||||||
self.connected = False # type: bool
|
self._connected = False # type: bool
|
||||||
self.connecting = False # type: bool
|
self.connecting = False # type: bool
|
||||||
self.keys_queried = False # type: bool
|
self.keys_queried = False # type: bool
|
||||||
self.reconnect_delay = 0 # type: int
|
self.reconnect_delay = 0 # type: int
|
||||||
|
@ -286,6 +286,16 @@ class MatrixServer(object):
|
||||||
).format(prefix=W.prefix("error"))
|
).format(prefix=W.prefix("error"))
|
||||||
W.prnt("", message)
|
W.prnt("", message)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def connected(self):
|
||||||
|
return self._connected
|
||||||
|
|
||||||
|
@connected.setter
|
||||||
|
def connected(self, value):
|
||||||
|
self._connected = value
|
||||||
|
W.bar_item_update("buffer_modes")
|
||||||
|
W.bar_item_update("matrix_modes")
|
||||||
|
|
||||||
def get_session_path(self):
|
def get_session_path(self):
|
||||||
home_dir = W.info_get("weechat_dir", "")
|
home_dir = W.info_get("weechat_dir", "")
|
||||||
return os.path.join(home_dir, "matrix", self.name)
|
return os.path.join(home_dir, "matrix", self.name)
|
||||||
|
|
Loading…
Add table
Reference in a new issue