Implement relay-independent join
This commit is contained in:
parent
14daa9dfef
commit
9c95fa8eaf
|
@ -1,4 +1,5 @@
|
||||||
import main
|
import main
|
||||||
|
import modules.chankeep
|
||||||
|
|
||||||
class JoinCommand:
|
class JoinCommand:
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
|
@ -6,7 +7,14 @@ class JoinCommand:
|
||||||
|
|
||||||
def join(self, addr, authed, data, obj, spl, success, failure, info, incUsage, length):
|
def join(self, addr, authed, data, obj, spl, success, failure, info, incUsage, length):
|
||||||
if authed:
|
if authed:
|
||||||
if length == 4:
|
if length == 3:
|
||||||
|
if not spl[1] in main.network.keys():
|
||||||
|
failure("Network does not exist: %s" % spl[1])
|
||||||
|
return
|
||||||
|
modules.chankeep.joinSingle(spl[1], spl[2])
|
||||||
|
success("Joined %s" % spl[2])
|
||||||
|
|
||||||
|
elif length == 4:
|
||||||
if not spl[1] in main.network.keys():
|
if not spl[1] in main.network.keys():
|
||||||
failure("Network does not exist: %s" % spl[1])
|
failure("Network does not exist: %s" % spl[1])
|
||||||
return
|
return
|
||||||
|
|
|
@ -111,6 +111,17 @@ def keepChannels(net, listinfo, mean, sigrelay, relay):
|
||||||
populateChans(net, siglist, sigrelay, newNums)
|
populateChans(net, siglist, sigrelay, newNums)
|
||||||
notifyJoin(net)
|
notifyJoin(net)
|
||||||
|
|
||||||
|
def joinSingle(net, channel):
|
||||||
|
if allRelaysActive(net):
|
||||||
|
chanfree = getChanFree(net, [])
|
||||||
|
print("chanfree", chanfree)
|
||||||
|
for i in chanfree[0]:
|
||||||
|
if chanfree[0][i] < 0:
|
||||||
|
print("JOIN CHAN")
|
||||||
|
else:
|
||||||
|
error("All relays for %s are not active" % net)
|
||||||
|
return False
|
||||||
|
|
||||||
def nukeNetwork(net):
|
def nukeNetwork(net):
|
||||||
#purgeRecords(net)
|
#purgeRecords(net)
|
||||||
#p = main.g.pipeline()
|
#p = main.g.pipeline()
|
||||||
|
|
Loading…
Reference in New Issue