self.update_login(nick_confirmed=False,
nickname=self.conn_setup.nickname)
self._log(f'connecting {self.conn_setup}')
- self.start_connecting()
+ self._start_connecting()
- def start_connecting(self) -> None:
- 'Start thread to set up _IrcConnection at .conn.'
+ def _start_connecting(self) -> None:
def connect(self) -> None:
try:
CMD_SHORTCUTS['privmsg'] = 'window.privmsg'
CMD_SHORTCUTS['reconnect'] = 'window.reconnect'
+_STREAM_SAME = '='
+
class _ClientWindow(Window, ClientQueueMixin):
def cmd__reconnect(self) -> None:
'Attempt reconnection.'
- self._client_trigger('start_connecting')
+ self._client_trigger('reconnect')
def cmd__nick(self, new_nick: str) -> None:
'Attempt nickname change.'
self._put(TuiEvent.affector('for_client_do').kw(
client_id=self.client_id, todo=todo, **kwargs))
+ def reconnect(self) -> None:
+ 'Catch /reconnect, only initiate if not connected, else complain back.'
+ if self.conn:
+ self._log('not re-connecting since already connected',
+ stream=_STREAM_SAME, alert=True)
+ return
+ self._start_connecting()
+
def _do_log(self, msg: str, stream: str = STREAM_SERVER) -> None:
- self._client_tui_trigger('log', stream=stream, msg=msg)
+ if stream == _STREAM_SAME:
+ self._put(TuiEvent.affector('_log').kw(msg=msg))
+ self._put(TuiEvent.affector('redraw_affected'))
+ else:
+ self._client_tui_trigger('log', stream=stream, msg=msg)
def update_login(self, nick_confirmed: bool, nickname: str = '') -> None:
super().update_login(nick_confirmed, nickname)