Parse sent data in IRCServer._send, not IRCServer.send

This commit is contained in:
jesopo 2019-02-10 20:49:03 +00:00
parent 89f035fdcf
commit abf5679b68
2 changed files with 7 additions and 3 deletions

View file

@ -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(

View file

@ -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)