From: Christian Heller Date: Thu, 5 Jun 2025 14:00:00 +0000 (+0200) Subject: Fix disconnect command still expecting single hardcoded server connection. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%22https:/validator.w3.org/tasks?a=commitdiff_plain;h=d7a3566d4e2d0b7fdc6acceec3911ecc5cd0f7ee;p=ircplom Fix disconnect command still expecting single hardcoded server connection. --- diff --git a/ircplom.py b/ircplom.py index 83ff8d1..16c3ca7 100755 --- a/ircplom.py +++ b/ircplom.py @@ -662,9 +662,15 @@ class TuiLoop(Loop): self.broadcast('INIT_CONNECTION', (hostname, (username, nickname, realname))) - def cmd__disconnect(self, quit_msg: str = 'ircplom says bye') -> None: - 'Send QUIT command to server.' - self.broadcast('SEND', IrcMessage('QUIT', [quit_msg])) + def cmd__disconnect(self, + quit_msg: str = 'ircplom says bye' + ) -> Optional[str]: + 'Send QUIT command to server if in connection window.' + if self.window not in self._conn_windows: + return 'what to disconnect from? (not in connection window!)' + self.broadcast('SEND', (self._conn_windows.index(self.window), + IrcMessage('QUIT', [quit_msg]))) + return None def cmd__prompt_enter(self) -> None: 'Get prompt content from .window.prompt.enter, parse to & run command.'