def connect(self) -> None:
try:
+ if self.conn:
+ raise IrcConnAbortException(
+ 'not re-connecting since already connected')
self.conn = _IrcConnection(hostname=self.conn_setup.hostname,
port=self.conn_setup.port,
q_out=self.q_out,
def affect(self, target: ClientsDb) -> None:
target[self.payload.id_] = self.payload
-
-
-@dataclass
-class InitReconnectEvent(ClientEvent):
- 'To trigger re-opening of connection.'
-
- def affect(self, target: 'Client') -> None:
- if target.conn:
- target.log.alert('reconnection called, but still seem connected, '
- 'so nothing to do.')
- else:
- target.start_connecting()
CMD_SHORTCUTS)
from ircplom.irc_conn import IrcMessage
from ircplom.client import (CHAT_GLOB, IrcConnSetup, Client, ClientEvent,
- ClientIdMixin, ClientQueueMixin,
- InitReconnectEvent, NewClientEvent)
+ ClientIdMixin, ClientQueueMixin, NewClientEvent)
CMD_SHORTCUTS['connect'] = 'window.connect'
if host_port:
self._parent.cmd__connect(host_port, nickname_pw, realname)
else:
- self._cput(InitReconnectEvent)
+ self._cput(ClientEvent.make_subtype('start_connecting'))
def cmd__nick(self, new_nick: str) -> None:
'Attempt nickname change.'