Function to select and merge IRC network defs
This commit is contained in:
parent
91885170f1
commit
63c97db12e
|
@ -1,17 +1,26 @@
|
||||||
import main
|
import main
|
||||||
from modules import provision
|
from modules import provision
|
||||||
from utils.logging.log import *
|
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):
|
def registerAccount(net, num):
|
||||||
alias = main.alias[num]
|
alias = main.alias[num]
|
||||||
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"]
|
||||||
if net in main.irc.keys():
|
inst = selectInst(net)
|
||||||
inst = main.irc[net]
|
|
||||||
else:
|
|
||||||
inst = main.irc["_"]
|
|
||||||
|
|
||||||
if not inst["register"]:
|
if not inst["register"]:
|
||||||
error("Cannot register for %s: function disabled" % (net))
|
error("Cannot register for %s: function disabled" % (net))
|
||||||
return False
|
return False
|
||||||
|
@ -25,10 +34,7 @@ def registerAccount(net, num):
|
||||||
main.IRCPool[name].msg(entity, cmd)
|
main.IRCPool[name].msg(entity, cmd)
|
||||||
|
|
||||||
def confirmAccount(net, num, token):
|
def confirmAccount(net, num, token):
|
||||||
if net in main.irc.keys():
|
inst = selectInst(net)
|
||||||
inst = main.irc[net]
|
|
||||||
else:
|
|
||||||
inst = main.irc["_"]
|
|
||||||
entity = inst["entity"]
|
entity = inst["entity"]
|
||||||
cmd = inst["confirm"]
|
cmd = inst["confirm"]
|
||||||
cmd = cmd.replace("{token}", token)
|
cmd = cmd.replace("{token}", token)
|
||||||
|
|
Loading…
Reference in New Issue