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.'