Implement API for authentication management actions

This commit is contained in:
2022-08-14 12:43:33 +01:00
parent 0b20a05b19
commit f7d390da32
5 changed files with 99 additions and 11 deletions

View File

@@ -55,7 +55,7 @@ class IRCBot(IRCClient):
self.isconnected = False
self.channels = []
self.net = net
self.authenticated = not regproc.needToRegister(self.net)
self.authenticated = not regproc.needToAuth(self.net)
self.num = num
self.buffer = ""
self.name = net + str(num)
@@ -621,8 +621,9 @@ class IRCBot(IRCClient):
def regPing(self, negativepass=None):
if self.authenticated:
return
if not regproc.needToRegister(self.net):
if not regproc.needToAuth(self.net):
self.authenticated = True
return
sinst = regproc.substitute(self.net, self.num)
if not sinst:
error(f"regPing() {self.net}: registration ping failed for {self.num}")
@@ -649,7 +650,12 @@ class IRCBot(IRCClient):
if sinst["negative"]:
self._negativePass = None
self.msg(sinst["entity"], sinst["negativemsg"])
debug(f"regPing() {self.net}: sent negativemsg '{sinst['negativemsg']}' to {sinst['entity']} - {self.num}")
debug(
(
f"regPing() {self.net}: sent negativemsg "
f"'{sinst['negativemsg']}' to {sinst['entity']} - {self.num}"
)
)
return
else:
self._negativePass = True