Implement indexing into Apache Druid #1
|
@ -9,19 +9,34 @@ class EmailCommand:
|
||||||
def email(self, addr, authed, data, obj, spl, success, failure, info, incUsage, length):
|
def email(self, addr, authed, data, obj, spl, success, failure, info, incUsage, length):
|
||||||
if authed:
|
if authed:
|
||||||
if length == 4:
|
if length == 4:
|
||||||
if not spl[2].isdigit():
|
if spl[1] == "add":
|
||||||
# failure("Must be a number, not %s" % spl[2])
|
if not spl[2].isdigit():
|
||||||
if spl[2] == "domain":
|
# failure("Must be a number, not %s" % spl[2])
|
||||||
domain = spl[3]
|
if spl[2] == "domain":
|
||||||
if "@" in domain:
|
domain = spl[3]
|
||||||
failure("Not a domain: %s" % domain)
|
if "@" in domain:
|
||||||
return
|
failure("Not a domain: %s" % domain)
|
||||||
if not domain in main.irc["_"]["domains"]:
|
return
|
||||||
main.irc["_"]["domains"].append(domain)
|
if not domain in main.irc["_"]["domains"]:
|
||||||
success("Successfully added domain %s to default config" % domain)
|
main.irc["_"]["domains"].append(domain)
|
||||||
else:
|
success("Successfully added domain %s to default config" % domain)
|
||||||
failure("Domain already exists in default config: %s" % domain)
|
main.saveConf("irc")
|
||||||
return
|
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])
|
||||||
|
if spl[2] == "domain":
|
||||||
|
domain = spl[3]
|
||||||
|
|
||||||
|
if domain in main.irc["_"]["domains"]:
|
||||||
|
main.irc["_"]["domains"].remove(domain)
|
||||||
|
success("Successfully removed domain %s to default config" % domain)
|
||||||
|
main.saveConf("irc")
|
||||||
|
else:
|
||||||
|
failure("Domain does not exist in default config: %s" % domain)
|
||||||
|
return
|
||||||
|
|
||||||
else:
|
else:
|
||||||
num = int(spl[2])
|
num = int(spl[2])
|
||||||
|
@ -53,12 +68,23 @@ class EmailCommand:
|
||||||
if spl[1] == "list":
|
if spl[1] == "list":
|
||||||
info(dump(main.alias))
|
info(dump(main.alias))
|
||||||
return
|
return
|
||||||
|
|
||||||
else:
|
else:
|
||||||
incUsage("save")
|
incUsage("email")
|
||||||
|
return
|
||||||
|
elif length == 3:
|
||||||
|
if spl[1] == "list":
|
||||||
|
if spl[2] == "domain":
|
||||||
|
filtered = {f"{k}:{k2}":v2 for k,v in main.irc.items() for k2,v2 in v.items() if k2 == "domains"}
|
||||||
|
info(dump(filtered))
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
incUsage("email")
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
incUsage("email")
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
incUsage("save")
|
incUsage("email")
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
incUsage(None)
|
incUsage(None)
|
||||||
|
|
Loading…
Reference in New Issue