From 153d3dd847b0b31c0f9378e5732577160f8ab40f Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sun, 14 Aug 2022 23:58:35 +0100 Subject: [PATCH] Reset negative pass status when requesting recheck --- api/views.py | 4 ++-- core/bot.py | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/api/views.py b/api/views.py index 280fd5b..adbac22 100644 --- a/api/views.py +++ b/api/views.py @@ -239,11 +239,11 @@ class API(object): return dumps({"success": False, "reason": f"failed to get instances for {net_name}."}) if func == "recheckauth": for conn in conns: - conn.regPing() + conn.regPing(reset=True) elif func == "resetauth": for conn in conns: conn.authenticated = False - conn.regPing() + conn.regPing(reset=True) elif func == "register": for conn in conns: regproc.registerAccount(conn.net, conn.num) diff --git a/core/bot.py b/core/bot.py index 91b02fd..4d33c5c 100644 --- a/core/bot.py +++ b/core/bot.py @@ -627,7 +627,7 @@ class IRCBot(IRCClient): # End of Twisted hackery - def regPing(self, negativepass=None): + def regPing(self, negativepass=None, reset=True): if self.authenticated: return if not regproc.needToAuth(self.net): @@ -637,6 +637,9 @@ class IRCBot(IRCClient): if not sinst: error(f"regPing() {self.net}: registration ping failed for {self.num}") return + if reset: + self._negativePass = None + if self._negativePass is not True: if negativepass is False: self._negativePass = False @@ -652,7 +655,7 @@ class IRCBot(IRCClient): debug(f"regPing() {self.net}: sent ping '{sinst['pingmsg']}' to {sinst['entity']} - {self.num}") return else: - debug("regPing() {self.net}: negative registration check - {self.num}") + debug(f"regPing() {self.net}: negative registration check - {self.num}") return if sinst["check"]: