From abf5679b682c560a98c53aa9fc8dd49fe1ad49b2 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sun, 10 Feb 2019 20:49:03 +0000 Subject: [PATCH] Parse sent data in IRCServer._send, not IRCServer.send --- modules/line_handler.py | 2 +- src/IRCServer.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/line_handler.py b/modules/line_handler.py index db28448f..22d505fa 100644 --- a/modules/line_handler.py +++ b/modules/line_handler.py @@ -42,7 +42,7 @@ class Module(ModuleManager.BaseModule): else: self._handle(event["server"], line) - @utils.hook("preprocess.send") + @utils.hook("raw.send") def handle_send(self, event): line = utils.irc.parse_line(event["line"]) self.events.on("raw.send").on(line.command).call_unsafe( diff --git a/src/IRCServer.py b/src/IRCServer.py index f37a45f0..ba2db432 100644 --- a/src/IRCServer.py +++ b/src/IRCServer.py @@ -319,8 +319,6 @@ class Server(IRCObject.Object): line_obj = IRCLine.Line(datetime.datetime.utcnow(), line_stripped) self.queued_lines.append(line_obj) - self.bot.log.debug("%s (raw send) | %s", [str(self), line]) - return line_obj def _send(self): @@ -329,6 +327,12 @@ class Server(IRCObject.Object): to_buffer = self.queued_lines[:throttle_space] self.queued_lines = self.queued_lines[throttle_space:] for line in to_buffer: + decoded_data = line.decoded_data() + self.bot.log.debug("%s (raw send) | %s", + [str(self), decoded_data]) + self.events.on("raw.send").call_unsafe( + server=self, line=decoded_data) + self.write_buffer += line.data() self.buffered_lines.append(line)