Use RPL_ENDOFMOTD or ERR_NOMOTD to denote end-of-registration and a time to

check if we got MONITOR in 005 at any point (nick_regain.py)
This commit is contained in:
jesopo 2019-02-12 20:48:52 +00:00
parent 554b041822
commit f2a7acfe4d

View file

@ -1,15 +1,20 @@
from src import ModuleManager, utils from src import ModuleManager, utils
class Module(ModuleManager.BaseModule): class Module(ModuleManager.BaseModule):
@utils.hook("received.numeric.251") def _done_connecting(self, server):
def on_connect(self, event): target_nick = server.connection_params.nickname
target_nick = event["server"].connection_params.nickname if not server.irc_equals(server.nickname, target_nick):
if not event["server"].irc_equals( if "MONITOR" in server.isupport:
event["server"].nickname, target_nick): server.send("MONITOR + %s" % target_nick)
if "MONITOR" in event["server"].isupport:
event["server"].send("MONITOR + %s" % target_nick)
else: else:
self.timers.add("ison-check", 30, server=event["server"]) self.timers.add("ison-check", 30, server=server)
@utils.hook("received.numeric.376")
def end_of_motd(self, event):
self._done_connecting(event["server"])
@utils.hook("received.numeric.422")
def no_motd(self, event):
self._done_connecting(event["server"])
@utils.hook("self.nick") @utils.hook("self.nick")
def self_nick(self, event): def self_nick(self, event):