Implement indexing into Apache Druid #1

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

View File

@ -499,5 +499,12 @@ class API(object):
name = f"{net}{num}" name = f"{net}{num}"
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}"})
main.IRCPool[name].sendmsg(channel, msg) # We are in a query
if channel == main.IRCPool[name].nickname:
if "nick" not in data:
return dumps({"success": False, "reason": "no nick specified to query"})
else:
main.IRCPool[name].sendmsg(data["nick"], msg, in_query=True)
else:
main.IRCPool[name].sendmsg(channel, msg)
return dumps({"success": True, "message": f"sent message to {channel} on {name}"}) return dumps({"success": True, "message": f"sent message to {channel} on {name}"})

View File

@ -16,7 +16,7 @@ from twisted.words.protocols.irc import (
import main import main
from core.relay import sendRelayNotification from core.relay import sendRelayNotification
from modules import chankeep, counters, helpers, monitor, regproc, userinfo, userinfo from modules import chankeep, counters, helpers, monitor, regproc, userinfo
from utils.dedup import dedup from utils.dedup import dedup
from utils.logging.debug import debug from utils.logging.debug import debug
from utils.logging.log import error, log, warn from utils.logging.log import error, log, warn
@ -252,7 +252,7 @@ class IRCBot(IRCClient):
def action(self, user, channel, msg): def action(self, user, channel, msg):
self.event(type="action", muser=user, channel=channel, msg=msg) self.event(type="action", muser=user, channel=channel, msg=msg)
def sendmsg(self, channel, msg): def sendmsg(self, channel, msg, in_query=False):
query = f"{self.nickname}!*@*" query = f"{self.nickname}!*@*"
us = list(userinfo.getWhoSingle(self.net, query)) us = list(userinfo.getWhoSingle(self.net, query))
if len(us) > 0: if len(us) > 0:
@ -262,8 +262,12 @@ class IRCBot(IRCClient):
hostmask = f"{self.nickname}!*@{self.servername}" hostmask = f"{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)
self.event(type="self", mtype="msg", channel=channel, nick=self.nickname, ident=ident, host=host, msg=msg) # We sent someone a query reply
self.event(type="msg", channel=channel, nick=self.nickname, ident=ident, host=host, msg=msg) if in_query:
self.event(type="self", mtype="msg", channel=self.nickname, nick=channel, ident=ident, host=host, msg=msg)
else:
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.msg(channel, msg) self.msg(channel, msg)
def get(self, var): def get(self, var):