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