From 2731713ede59df100fa5f20fb38426c74ddac73c Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sat, 27 Aug 2022 11:19:28 +0100 Subject: [PATCH] Fix error when no email can be found --- commands/dedup.py | 5 +++-- modules/helpers.py | 1 - modules/regproc.py | 9 ++++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/commands/dedup.py b/commands/dedup.py index 168b955..0a286fc 100644 --- a/commands/dedup.py +++ b/commands/dedup.py @@ -1,7 +1,8 @@ +from json import dumps + import main from modules import chankeep -from modules import helpers -from json import dumps + class DedupCommand: def __init__(self, *args): diff --git a/modules/helpers.py b/modules/helpers.py index 05d5bf2..edd7ac2 100644 --- a/modules/helpers.py +++ b/modules/helpers.py @@ -1,6 +1,5 @@ import main from modules import chankeep - from utils.logging.debug import debug diff --git a/modules/regproc.py b/modules/regproc.py index d6d3c28..e9e2e1f 100644 --- a/modules/regproc.py +++ b/modules/regproc.py @@ -55,8 +55,7 @@ def substitute(net, num, token=None): email = f"{alias['nickname']}@{domain}" gotemail = True if not gotemail: - error(f"Could not get email for {net} - {num}") - return False + inst["email"] = False nickname = alias["nick"] # username = nickname + "/" + net password = main.network[net].aliases[num]["password"] @@ -73,7 +72,8 @@ def substitute(net, num, token=None): inst[i] = inst[i].replace("{nickname}", nickname) inst[i] = inst[i].replace("{curnick}", curnick) inst[i] = inst[i].replace("{password}", password) - inst[i] = inst[i].replace("{email}", email) + if gotemail: + inst[i] = inst[i].replace("{email}", email) if token: inst[i] = inst[i].replace("{token}", token) return inst @@ -85,6 +85,9 @@ def registerAccount(net, num): if not sinst: error(f"Register account failed for {net} - {num}") return + if not sinst["email"]: + error(f"Could not get email for {net} - {num}") + return if not sinst["register"]: error("Cannot register for %s: function disabled" % (net)) return False