Implement indexing into Apache Druid #1

Closed
m wants to merge 263 commits from druid into master
5 changed files with 49 additions and 1 deletions
Showing only changes of commit 1f178a20ed - Show all commits

1
.gitignore vendored
View File

@ -10,4 +10,5 @@ conf/network.dat
conf/alias.json conf/alias.json
conf/irc.json conf/irc.json
conf/dist.sh conf/dist.sh
conf/blacklist.json
env/ env/

41
commands/blacklist.py Normal file
View File

@ -0,0 +1,41 @@
import main
from yaml import dump
class BlacklistCommand:
def __init__(self, *args):
self.blacklist(*args)
def blacklist(self, addr, authed, data, obj, spl, success, failure, info, incUsage, length):
if authed:
if length == 1:
info(dump(main.blacklist))
return
elif length == 4:
if spl[1] == "add":
if spl[2] in main.blacklist.keys():
main.blacklist[spl[2]].append(spl[3])
else:
main.blacklist[spl[2]] = [spl[3]]
success("Blacklisted %s on %s" % (spl[3], spl[2]))
main.saveConf("blacklist")
return
elif spl[1] == "del":
if spl[2] in main.blacklist.keys():
if spl[3] in main.blacklist[spl[2]]:
main.blacklist[spl[2]].remove(spl[3])
if len(main.blacklist[spl[2]]) == 0:
del main.blacklist[spl[2]]
else:
failure("Not in list: %s" % spl[3])
return
else:
failure("No such entry: %s" % spl[2])
return
success("Removed blacklist %s on %s" % (spl[3], spl[2]))
main.saveConf("blacklist")
return
else:
incUsage("blacklist")
return
else:
incUsage(None)

View File

@ -32,5 +32,6 @@
"confirm": "confirm <network> <num> <token>", "confirm": "confirm <network> <num> <token>",
"pending": "pending [<network>]", "pending": "pending [<network>]",
"authcheck": "authcheck [<network>]", "authcheck": "authcheck [<network>]",
"recheckauth": "recheckauth [<network>]" "recheckauth": "recheckauth [<network>]",
"blacklist": "blacklist <network> <channel>"
} }

View File

@ -181,6 +181,10 @@ class IRCBot(IRCClient):
increment = 0.8 increment = 0.8
for i in channels: for i in channels:
if not i in self.channels: if not i in self.channels:
if self.net in main.blacklist.keys():
if i in main.blacklist[self.net]:
debug("Not joining blacklisted channel %s on %s - %i" % (i, self.net, self.num))
continue
debug(self.net, "-", self.num, ": joining", i, "in", sleeptime, "seconds") debug(self.net, "-", self.num, ": joining", i, "in", sleeptime, "seconds")
reactor.callLater(sleeptime, self.join, i) reactor.callLater(sleeptime, self.join, i)
sleeptime += increment sleeptime += increment

View File

@ -24,6 +24,7 @@ filemap = {
"aliasdata": ["aliasdata.json", "data for alias generation", "json"], "aliasdata": ["aliasdata.json", "data for alias generation", "json"],
"alias": ["alias.json", "provisioned alias data", "json"], "alias": ["alias.json", "provisioned alias data", "json"],
"irc": ["irc.json", "IRC network definitions", "json"], "irc": ["irc.json", "IRC network definitions", "json"],
"blacklist": ["blacklist.json", "IRC channel blacklist", "json"],
# Binary (pickle) configs # Binary (pickle) configs
"network": ["network.dat", "network list", "pickle"] "network": ["network.dat", "network list", "pickle"]