Error checking on alias removal and clean up when removing relays
This commit is contained in:
@@ -11,16 +11,6 @@ class AliasCommand:
|
||||
if length == 1:
|
||||
info(dump(main.alias))
|
||||
return
|
||||
elif length == 2:
|
||||
if spl[1] == "add":
|
||||
nextNum = max(main.alias.keys())+1
|
||||
main.alias[nextNum] = alias.generate_alias()
|
||||
success("Generated new alias: %i" % nextNum)
|
||||
main.saveConf("alias")
|
||||
return
|
||||
else:
|
||||
incUsage("alias")
|
||||
return
|
||||
elif length == 3:
|
||||
if spl[1] == "add":
|
||||
if not spl[2].isdigit():
|
||||
@@ -28,7 +18,10 @@ class AliasCommand:
|
||||
return
|
||||
num = int(spl[2])
|
||||
for i in range(num):
|
||||
nextNum = max(main.alias.keys())+1
|
||||
if len(main.alias.keys()) == 0:
|
||||
nextNum = 1
|
||||
else:
|
||||
nextNum = max(main.alias.keys())+1
|
||||
main.alias[nextNum] = alias.generate_alias()
|
||||
success("Generated new alias: %i" % nextNum)
|
||||
main.saveConf("alias")
|
||||
@@ -38,6 +31,9 @@ class AliasCommand:
|
||||
failure("Must be a number, not %s" % spl[2])
|
||||
return
|
||||
num = int(spl[2])
|
||||
if not num in main.alias.keys():
|
||||
failure("No such alias: %i" % num)
|
||||
return
|
||||
failed = False
|
||||
for i in main.network.keys():
|
||||
if num in main.network[i].aliases.keys():
|
||||
|
||||
Reference in New Issue
Block a user