Update modules/line_handler.py to now not pass a server param to

utils.irc.parse_line
This commit is contained in:
jesopo 2018-10-30 17:52:23 +00:00
parent b543e31cd2
commit b58a3f7329

View file

@ -14,7 +14,7 @@ CAPABILITIES = {"multi-prefix", "chghost", "invite-notify", "account-tag",
"batch", "draft/labeled-response"} "batch", "draft/labeled-response"}
class Module(ModuleManager.BaseModule): class Module(ModuleManager.BaseModule):
def _handle(self, line): def _handle(self, server, line):
hooks = self.events.on("raw").on(line.command).get_hooks() hooks = self.events.on("raw").on(line.command).get_hooks()
default_events = [] default_events = []
for hook in hooks: for hook in hooks:
@ -23,7 +23,7 @@ class Module(ModuleManager.BaseModule):
kwargs = {"args": line.args, "arbitrary": line.arbitrary, kwargs = {"args": line.args, "arbitrary": line.arbitrary,
"tags": line.tags, "last": line.last, "tags": line.tags, "last": line.last,
"server": line.server, "prefix": line.prefix} "server": server, "prefix": line.prefix}
self.events.on("raw").on(line.command).call_unsafe(**kwargs) self.events.on("raw").on(line.command).call_unsafe(**kwargs)
if default_event or not hooks: if default_event or not hooks:
@ -32,21 +32,22 @@ class Module(ModuleManager.BaseModule):
**kwargs) **kwargs)
else: else:
self.events.on("received").on(line.command).call(**kwargs) self.events.on("received").on(line.command).call(**kwargs)
@utils.hook("raw") @utils.hook("raw")
def handle_raw(self, event): def handle_raw(self, event):
line = utils.irc.parse_line(event["server"], event["line"]) line = utils.irc.parse_line(event["line"])
if "batch" in line.tags and line.tags["batch"] in event[ if "batch" in line.tags and line.tags["batch"] in event[
"server"].batches: "server"].batches:
server.batches[tag["batch"]].append(line) server.batches[tag["batch"]].append(line)
else: else:
self._handle(line) self._handle(event["server"], line)
@utils.hook("preprocess.send") @utils.hook("preprocess.send")
def handle_send(self, event): def handle_send(self, event):
line = utils.irc.parse_line(event["server"], event["line"]) line = utils.irc.parse_line(event["line"])
self.events.on("send").on(line.command).call( self.events.on("send").on(line.command).call(
args=line.args, arbitrary=line.arbitrary, tags=line.tags, args=line.args, arbitrary=line.arbitrary, tags=line.tags,
last=line.last, server=line.server) last=line.last, server=event["server"])
# ping from the server # ping from the server
@utils.hook("raw.ping") @utils.hook("raw.ping")