Extra error handling around emails
This commit is contained in:
parent
1532cf482c
commit
757b22c4a1
|
@ -658,6 +658,9 @@ class IRCBot(IRCClient):
|
||||||
if self.authenticated:
|
if self.authenticated:
|
||||||
return
|
return
|
||||||
sinst = regproc.substitute(self.net, self.num)
|
sinst = regproc.substitute(self.net, self.num)
|
||||||
|
if not sinst:
|
||||||
|
error(f"Registration ping failed for {self.net} - {self.num}")
|
||||||
|
return
|
||||||
if not self._negativePass == True:
|
if not self._negativePass == True:
|
||||||
if negativepass == False:
|
if negativepass == False:
|
||||||
self._negativePass = False
|
self._negativePass = False
|
||||||
|
|
|
@ -5,7 +5,12 @@ from twisted.internet import reactor
|
||||||
import modules.regproc
|
import modules.regproc
|
||||||
|
|
||||||
|
|
||||||
def provisionUserNetworkData(num, nick, altnick, emails, ident, realname, network, host, port, security, auth, password):
|
def provisionUserNetworkData(num, nick, altnick, ident, realname, emails, network, host, port, security, auth, password):
|
||||||
|
print("nick", nick)
|
||||||
|
print("altnick", altnick)
|
||||||
|
print("emails", emails)
|
||||||
|
print("ident", ident)
|
||||||
|
print("realname", realname)
|
||||||
commands = {}
|
commands = {}
|
||||||
stage2commands = {}
|
stage2commands = {}
|
||||||
stage2commands["status"] = []
|
stage2commands["status"] = []
|
||||||
|
@ -56,6 +61,7 @@ def provisionAuthenticationData(num, nick, network, security, auth, password):
|
||||||
|
|
||||||
def provisionRelay(num, network): # provision user and network data
|
def provisionRelay(num, network): # provision user and network data
|
||||||
aliasObj = main.alias[num]
|
aliasObj = main.alias[num]
|
||||||
|
print("ALIASOBJ FALUES", aliasObj.values())
|
||||||
alias = aliasObj["nick"]
|
alias = aliasObj["nick"]
|
||||||
provisionUserNetworkData(
|
provisionUserNetworkData(
|
||||||
num,
|
num,
|
||||||
|
|
|
@ -28,13 +28,21 @@ def selectInst(net):
|
||||||
def substitute(net, num, token=None):
|
def substitute(net, num, token=None):
|
||||||
inst = selectInst(net)
|
inst = selectInst(net)
|
||||||
alias = main.alias[num]
|
alias = main.alias[num]
|
||||||
if "emails" in inst:
|
gotemail = False
|
||||||
|
if "emails" in alias:
|
||||||
# First priority is explicit email lists
|
# First priority is explicit email lists
|
||||||
email = choice(alias["emails"])
|
if alias["emails"]:
|
||||||
elif "domains" in inst:
|
email = choice(alias["emails"])
|
||||||
domain = choice(inst["domains"])
|
gotemail = True
|
||||||
email = f"{alias['nickname']}@{domain}"
|
if "domains" in inst:
|
||||||
print("Constructed email: {email}")
|
if inst["domains"]:
|
||||||
|
if not gotemail:
|
||||||
|
domain = choice(inst["domains"])
|
||||||
|
email = f"{alias['nickname']}@{domain}"
|
||||||
|
gotemail = True
|
||||||
|
if not gotemail:
|
||||||
|
error(f"Could not get email for {net} - {num}")
|
||||||
|
return False
|
||||||
nickname = alias["nick"]
|
nickname = alias["nick"]
|
||||||
username = nickname + "/" + net
|
username = nickname + "/" + net
|
||||||
password = main.network[net].aliases[num]["password"]
|
password = main.network[net].aliases[num]["password"]
|
||||||
|
@ -53,6 +61,9 @@ def substitute(net, num, token=None):
|
||||||
def registerAccount(net, num):
|
def registerAccount(net, num):
|
||||||
debug("Attempting to register: %s - %i" % (net, num))
|
debug("Attempting to register: %s - %i" % (net, num))
|
||||||
sinst = substitute(net, num)
|
sinst = substitute(net, num)
|
||||||
|
if not sinst:
|
||||||
|
error(f"Register account failed for {net} - {num}")
|
||||||
|
return
|
||||||
if not sinst["register"]:
|
if not sinst["register"]:
|
||||||
error("Cannot register for %s: function disabled" % (net))
|
error("Cannot register for %s: function disabled" % (net))
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in New Issue