Implement indexing into Apache Druid #1

Closed
m wants to merge 263 commits from druid into master
2 changed files with 13 additions and 5 deletions
Showing only changes of commit 36628e157d - Show all commits

View File

@ -608,13 +608,21 @@ class API(object):
if name not in main.IRCPool.keys(): if name not in main.IRCPool.keys():
return dumps({"success": False, "reason": f"relay {num} not on {net}"}) return dumps({"success": False, "reason": f"relay {num} not on {net}"})
# We are in a query # We are in a query
in_query = False
if "nick" in data:
nick = data["nick"]
if nick == channel:
in_query = True
else:
nick = None
if channel == main.IRCPool[name].nickname: if channel == main.IRCPool[name].nickname:
if "nick" not in data: in_query = True
if nick:
return dumps({"success": False, "reason": "no nick specified to query"}) return dumps({"success": False, "reason": "no nick specified to query"})
else: else:
main.IRCPool[name].sendmsg(data["nick"], msg, in_query=True) main.IRCPool[name].sendmsg(nick, msg, in_query=in_query)
else: else:
main.IRCPool[name].sendmsg(channel, msg) main.IRCPool[name].sendmsg(channel, msg, in_query=in_query)
return dumps({"success": True, "message": f"sent message to {channel} on {name}"}) return dumps({"success": True, "message": f"sent message to {channel} on {name}"})
@app.route("/irc/nick/<net>/<num>/", methods=["GET"]) @app.route("/irc/nick/<net>/<num>/", methods=["GET"])

View File

@ -272,7 +272,7 @@ class IRCBot(IRCClient):
hostmask = us[0] hostmask = us[0]
else: else:
# Close enough... # Close enough...
hostmask = f"{self.nickname}!*@{self.servername}" hostmask = f"{self.nickname}!{self.nickname}@{self.servername}"
warn(f"Could not get a hostname, using {hostmask}") warn(f"Could not get a hostname, using {hostmask}")
nick, ident, host = parsen(hostmask) nick, ident, host = parsen(hostmask)
# We sent someone a query reply # We sent someone a query reply
@ -280,7 +280,7 @@ class IRCBot(IRCClient):
self.event(type="self", mtype="msg", channel=self.nickname, nick=channel, ident=ident, host=host, msg=msg) self.event(type="self", mtype="msg", channel=self.nickname, nick=channel, ident=ident, host=host, msg=msg)
else: else:
self.event(type="self", mtype="msg", channel=channel, nick=self.nickname, ident=ident, host=host, msg=msg) self.event(type="self", mtype="msg", channel=channel, nick=self.nickname, ident=ident, host=host, msg=msg)
self.event(type="msg", channel=channel, nick=self.nickname, ident=ident, host=host, msg=msg) # self.event(type="msg", channel=channel, nick=self.nickname, ident=ident, host=host, msg=msg)
self.msg(channel, msg) self.msg(channel, msg)
def get(self, var): def get(self, var):