From 032c67be66bb792a29cc90cb6882058b612f1a28 Mon Sep 17 00:00:00 2001 From: jesopo Date: Fri, 21 Jun 2019 10:41:22 +0100 Subject: [PATCH] move echo-message to it's own module, eat events before they hit fake_echo.py --- modules/ircv3_echo_message.py | 11 +++++++++++ modules/line_handler/ircv3.py | 1 - 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 modules/ircv3_echo_message.py diff --git a/modules/ircv3_echo_message.py b/modules/ircv3_echo_message.py new file mode 100644 index 00000000..3db7a6a9 --- /dev/null +++ b/modules/ircv3_echo_message.py @@ -0,0 +1,11 @@ +from src import EventManager, ModuleManager, utils + +CAP = utils.irc.Capability("echo-message") + +@utils.export("cap", CAP) +class Module(ModuleManager.BaseModule): + @utils.hook("raw.send.privmsg", priority=EventManager.PRIORITY_LOW) + @utils.hook("raw.send.notice", priority=EventManager.PRIORITY_LOW) + def send_message(self, event): + if event["server"].has_capability(CAP): + event.eat() diff --git a/modules/line_handler/ircv3.py b/modules/line_handler/ircv3.py index 93b814c8..23d14ed5 100644 --- a/modules/line_handler/ircv3.py +++ b/modules/line_handler/ircv3.py @@ -12,7 +12,6 @@ CAPABILITIES = [ utils.irc.Capability("message-tags", "draft/message-tags-0.2"), utils.irc.Capability("cap-notify"), utils.irc.Capability("batch"), - utils.irc.Capability("echo-message"), utils.irc.Capability(None, "draft/rename"), utils.irc.Capability(None, "draft/setname") ]