Function to select and merge IRC network defs
This commit is contained in:
parent
5c6b626396
commit
81b0450904
|
@ -1,17 +1,26 @@
|
|||
import main
|
||||
from modules import provision
|
||||
from utils.logging.log import *
|
||||
from copy import deepcopy
|
||||
|
||||
def selectInst(net):
|
||||
if net in main.irc.keys():
|
||||
inst = deepcopy(main.irc[net])
|
||||
for i in main.irc["_"].keys():
|
||||
if not i in inst:
|
||||
inst[i] = main.irc["_"][i]
|
||||
else:
|
||||
inst = main.irc["_"]
|
||||
print(inst)
|
||||
print("hello")
|
||||
return inst
|
||||
|
||||
def registerAccount(net, num):
|
||||
alias = main.alias[num]
|
||||
nickname = alias["nick"]
|
||||
username = nickname+"/"+net
|
||||
password = main.network[net].aliases[num]["password"]
|
||||
if net in main.irc.keys():
|
||||
inst = main.irc[net]
|
||||
else:
|
||||
inst = main.irc["_"]
|
||||
|
||||
inst = selectInst(net)
|
||||
if not inst["register"]:
|
||||
error("Cannot register for %s: function disabled" % (net))
|
||||
return False
|
||||
|
@ -25,10 +34,7 @@ def registerAccount(net, num):
|
|||
main.IRCPool[name].msg(entity, cmd)
|
||||
|
||||
def confirmAccount(net, num, token):
|
||||
if net in main.irc.keys():
|
||||
inst = main.irc[net]
|
||||
else:
|
||||
inst = main.irc["_"]
|
||||
inst = selectInst(net)
|
||||
entity = inst["entity"]
|
||||
cmd = inst["confirm"]
|
||||
cmd = cmd.replace("{token}", token)
|
||||
|
|
Loading…
Reference in New Issue