Implement indexing into Apache Druid #1
|
@ -5,7 +5,7 @@ from twisted.internet import reactor
|
||||||
import modules.regproc
|
import modules.regproc
|
||||||
|
|
||||||
|
|
||||||
def provisionUserNetworkData(num, nick, altnick, ident, realname, network, host, port, security, auth, password):
|
def provisionUserNetworkData(num, nick, altnick, emails, ident, realname, network, host, port, security, auth, password):
|
||||||
commands = {}
|
commands = {}
|
||||||
stage2commands = {}
|
stage2commands = {}
|
||||||
stage2commands["status"] = []
|
stage2commands["status"] = []
|
||||||
|
|
|
@ -3,7 +3,7 @@ from modules import provision
|
||||||
from utils.logging.log import *
|
from utils.logging.log import *
|
||||||
from utils.logging.debug import *
|
from utils.logging.debug import *
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
from random import choice
|
||||||
|
|
||||||
def needToRegister(net):
|
def needToRegister(net):
|
||||||
inst = selectInst(net)
|
inst = selectInst(net)
|
||||||
|
@ -28,16 +28,23 @@ 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:
|
||||||
|
# First priority is explicit email lists
|
||||||
|
email = choice(alias["emails"])
|
||||||
|
elif "domains" in inst:
|
||||||
|
domain = choice(inst["domains"])
|
||||||
|
email = f"{alias['nickname']}@{domain}"
|
||||||
|
print("Constructed email: {email}")
|
||||||
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"]
|
||||||
inst["email"] = inst["email"].replace("{nickname}", nickname)
|
#inst["email"] = inst["email"].replace("{nickname}", nickname)
|
||||||
for i in inst.keys():
|
for i in inst.keys():
|
||||||
if not isinstance(inst[i], str):
|
if not isinstance(inst[i], str):
|
||||||
continue
|
continue
|
||||||
inst[i] = inst[i].replace("{nickname}", nickname)
|
inst[i] = inst[i].replace("{nickname}", nickname)
|
||||||
inst[i] = inst[i].replace("{password}", password)
|
inst[i] = inst[i].replace("{password}", password)
|
||||||
inst[i] = inst[i].replace("{email}", inst["email"])
|
inst[i] = inst[i].replace("{email}", email)
|
||||||
if token:
|
if token:
|
||||||
inst[i] = inst[i].replace("{token}", token)
|
inst[i] = inst[i].replace("{token}", token)
|
||||||
return inst
|
return inst
|
||||||
|
|
Loading…
Reference in New Issue