Fix email command
This commit is contained in:
parent
b871fea039
commit
f7d6cec896
|
@ -11,8 +11,21 @@ class EmailCommand:
|
|||
if authed:
|
||||
if length == 4:
|
||||
if spl[1] == "add":
|
||||
if not spl[2].isdigit():
|
||||
# failure("Must be a number, not %s" % spl[2])
|
||||
if spl[2].isdigit():
|
||||
num = int(spl[2])
|
||||
if num not in main.alias.keys():
|
||||
failure("No such alias: %i" % num)
|
||||
return
|
||||
if not spl[3] in main.alias[num]["emails"]:
|
||||
main.alias[num]["emails"].append(spl[3])
|
||||
main.saveConf("alias")
|
||||
success("Successfully added email %s to alias %i" % (spl[3], num))
|
||||
return
|
||||
else:
|
||||
failure("Email already exists in alias %i: %s" % (num, spl[3]))
|
||||
return
|
||||
else:
|
||||
failure("Must be a number, not %s" % spl[2])
|
||||
if spl[2] == "domain":
|
||||
domain = spl[3]
|
||||
if "@" in domain:
|
||||
|
@ -25,6 +38,7 @@ class EmailCommand:
|
|||
else:
|
||||
failure("Domain already exists in default config: %s" % domain)
|
||||
return
|
||||
|
||||
elif spl[1] == "del":
|
||||
if not spl[2].isdigit():
|
||||
# failure("Must be a number, not %s" % spl[2])
|
||||
|
@ -39,20 +53,6 @@ class EmailCommand:
|
|||
failure("Domain does not exist in default config: %s" % domain)
|
||||
return
|
||||
|
||||
else:
|
||||
num = int(spl[2])
|
||||
if spl[1] == "add":
|
||||
if num not in main.alias.keys():
|
||||
failure("No such alias: %i" % num)
|
||||
return
|
||||
if not spl[3] in main.alias[num]["emails"]:
|
||||
main.alias[num]["emails"].append(spl[3])
|
||||
main.saveConf("alias")
|
||||
success("Successfully added email %s to alias %i" % (spl[3], num))
|
||||
return
|
||||
else:
|
||||
failure("Email already exists in alias %i: %s" % (num, spl[3]))
|
||||
return
|
||||
elif spl[1] == "del":
|
||||
if num not in main.alias.keys():
|
||||
failure("No such alias: %i" % num)
|
||||
|
|
Loading…
Reference in New Issue