From d7a3566d4e2d0b7fdc6acceec3911ecc5cd0f7ee Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Thu, 5 Jun 2025 16:00:00 +0200 Subject: [PATCH] Fix disconnect command still expecting single hardcoded server connection. --- ircplom.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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.' -- 2.30.2