Implement indexing into Apache Druid #1

Closed
m wants to merge 263 commits from druid into master
2 changed files with 56 additions and 1 deletions
Showing only changes of commit 5179c43972 - Show all commits

55
commands/email.py Normal file
View File

@ -0,0 +1,55 @@
import main
from yaml import dump
class EmailCommand:
def __init__(self, *args):
self.email(*args)
def email(self, addr, authed, data, obj, spl, success, failure, info, incUsage, length):
if authed:
if length == 4:
if spl[1] == "add":
if not spl[2].isdigit():
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
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 not spl[2].isdigit():
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
if spl[3] in main.alias[num]["emails"]:
main.alias[num]["emails"].remove(spl[3])
main.saveConf("alias")
success("Successfully removed email %s from alias %i" % (spl[3], num))
return
else:
failure("Email does not exist in alias %i: %s" % (spl[3], num))
return
elif length == 2:
if spl[1] == "list":
info(dump(main.alias))
return
else:
incUsage("save")
return
else:
incUsage("save")
return
else:
incUsage(None)

View File

@ -63,4 +63,4 @@ def generate_alias():
if rand == 3 or rand == 4: if rand == 3 or rand == 4:
realname = realname.capitalize() realname = realname.capitalize()
return {"nick": nick, "altnick": altnick, "ident": ident, "realname": realname} return {"nick": nick, "altnick": altnick, "ident": ident, "realname": realname, "emails": []}