From ee8c7813f77ac9c9baa46041ca31155c6d19c0e9 Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 16 Apr 2019 13:47:06 +0100 Subject: [PATCH] Add IRCServer.send_raw so modules don't have to parse messages before sending them --- modules/admin.py | 3 +-- modules/perform.py | 2 +- src/IRCServer.py | 2 ++ 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/admin.py b/modules/admin.py index 24fa22a3..c9096e54 100644 --- a/modules/admin.py +++ b/modules/admin.py @@ -18,8 +18,7 @@ class Module(ModuleManager.BaseModule): :usage: :permission: raw """ - line = utils.irc.parse_line(event["args"]) - event["server"].send(line) + event["server"].send_raw(event["args"]) @utils.hook("received.command.part") def part(self, event): diff --git a/modules/perform.py b/modules/perform.py index 3dfe34d2..c04ea092 100644 --- a/modules/perform.py +++ b/modules/perform.py @@ -8,7 +8,7 @@ class Module(ModuleManager.BaseModule): for j, part in enumerate(command[:]): command[j] = part.replace("%nick%", server.nickname) command = "%".join(command) - server.send(utils.irc.parse_line(command)) + server.send_raw(command) @utils.hook("received.001", priority=EventManager.PRIORITY_URGENT) def on_connect(self, event): diff --git a/src/IRCServer.py b/src/IRCServer.py index d33fa228..3989374f 100644 --- a/src/IRCServer.py +++ b/src/IRCServer.py @@ -252,6 +252,8 @@ class Server(IRCObject.Object): line_parsed) self.socket.send(line_obj) return line_obj + def send_raw(self, line: str): + return self.send(utils.irc.parse_line(line)) def _send(self): lines = self.socket._send()