From 2fdd0cf6b8e09b960df194821354f73a28971a00 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sun, 14 Aug 2022 15:53:18 +0100 Subject: [PATCH] Allow current nick substitution in IRC commands --- conf/templates/irc.json | 1 + modules/regproc.py | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/conf/templates/irc.json b/conf/templates/irc.json index e37a788..6ec2722 100644 --- a/conf/templates/irc.json +++ b/conf/templates/irc.json @@ -4,6 +4,7 @@ "entity": "NickServ", "domains": [], "registermsg": "REGISTER {password} {email}", + "identifymsg": "IDENTIFY {password}", "confirm": "CONFIRM {token}", "check": true, "ping": true, diff --git a/modules/regproc.py b/modules/regproc.py index 685568f..0fc5107 100644 --- a/modules/regproc.py +++ b/modules/regproc.py @@ -2,7 +2,7 @@ from copy import deepcopy from random import choice import main -from modules import provision +from modules import provision, helpers from utils.logging.debug import debug from utils.logging.log import error @@ -61,10 +61,17 @@ def substitute(net, num, token=None): # username = nickname + "/" + net password = main.network[net].aliases[num]["password"] # inst["email"] = inst["email"].replace("{nickname}", nickname) + + name = f"{net}{num}" + if name in main.IRCPool: + curnick = main.IRCPool[name].nickname + else: + curnick = nickname for i in inst.keys(): if not isinstance(inst[i], str): continue 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 token: