From faf240106907782dd3771af30eaf08dbc0b9af45 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sat, 16 Feb 2019 15:53:14 +0000 Subject: [PATCH] 'received.numeric.###' -> 'received.###' throughout project --- modules/bot_channel.py | 2 +- modules/channel_save.py | 2 +- modules/line_handler.py | 6 +----- modules/nick_regain.py | 8 ++++---- modules/nickserv.py | 2 +- modules/perform.py | 2 +- modules/print_activity.py | 4 ++-- modules/resume.py | 2 +- modules/sasl/__init__.py | 6 +++--- 9 files changed, 15 insertions(+), 19 deletions(-) diff --git a/modules/bot_channel.py b/modules/bot_channel.py index 6f0f4d04..a15f37ff 100644 --- a/modules/bot_channel.py +++ b/modules/bot_channel.py @@ -3,7 +3,7 @@ from src import ModuleManager, utils @utils.export("serverset", {"setting": "bot-channel", "help": "Set main channel"}) class Module(ModuleManager.BaseModule): - @utils.hook("received.numeric.001") + @utils.hook("received.001") def do_join(self, event): bot_channel = event["server"].get_setting("bot-channel", self.bot.config.get("bot-channel", "#bitbot")) diff --git a/modules/channel_save.py b/modules/channel_save.py index 4d92cdb4..7ae694e2 100644 --- a/modules/channel_save.py +++ b/modules/channel_save.py @@ -1,7 +1,7 @@ from src import ModuleManager, utils class Module(ModuleManager.BaseModule): - @utils.hook("received.numeric.001") + @utils.hook("received.001") def on_connect(self, event): channels = event["server"].get_setting("autojoin", []) if not channels: diff --git a/modules/line_handler.py b/modules/line_handler.py index c6448066..f8a37103 100644 --- a/modules/line_handler.py +++ b/modules/line_handler.py @@ -33,11 +33,7 @@ class Module(ModuleManager.BaseModule): self.events.on("raw.received").on(line.command).call_unsafe(**kwargs) if default_event or not hooks: - if line.command.isdigit(): - self.events.on("received.numeric").on(line.command).call( - **kwargs) - else: - self.events.on("received").on(line.command).call(**kwargs) + self.events.on("received").on(line.command).call(**kwargs) @utils.hook("raw.received") def handle_raw(self, event): diff --git a/modules/nick_regain.py b/modules/nick_regain.py index 4446e751..10577f99 100644 --- a/modules/nick_regain.py +++ b/modules/nick_regain.py @@ -9,10 +9,10 @@ class Module(ModuleManager.BaseModule): else: self.timers.add("ison-check", 30, server=server) - @utils.hook("received.numeric.376") + @utils.hook("received.376") def end_of_motd(self, event): self._done_connecting(event["server"]) - @utils.hook("received.numeric.422") + @utils.hook("received.422") def no_motd(self, event): self._done_connecting(event["server"]) @@ -23,7 +23,7 @@ class Module(ModuleManager.BaseModule): if "MONITOR" in event["server"].isupport: event["server"].send("MONITOR - %s " % target_nick) - @utils.hook("received.numeric.731") + @utils.hook("received.731") def mon_offline(self, event): target_nick = event["server"].connection_params.nickname nicks = event["args"][1].split(",") @@ -39,7 +39,7 @@ class Module(ModuleManager.BaseModule): event["server"].send("ISON %s" % target_nick) event["timer"].redo() - @utils.hook("received.numeric.303") + @utils.hook("received.303") def ison_response(self, event): target_nick = event["server"].connection_params.nickname if not event["args"][1] and not event["server"].irc_equals( diff --git a/modules/nickserv.py b/modules/nickserv.py index 5633b7a7..891af663 100644 --- a/modules/nickserv.py +++ b/modules/nickserv.py @@ -4,7 +4,7 @@ from src import EventManager, ModuleManager, utils @utils.export("serverset", {"setting": "nickserv-password", "help": "Set the nickserv password for this server"}) class Module(ModuleManager.BaseModule): - @utils.hook("received.numeric.001", priority=EventManager.PRIORITY_URGENT) + @utils.hook("received.001", priority=EventManager.PRIORITY_URGENT) def on_connect(self, event): nickserv_password = event["server"].get_setting("nickserv-password") if nickserv_password: diff --git a/modules/perform.py b/modules/perform.py index cfae1d47..95e4dcc8 100644 --- a/modules/perform.py +++ b/modules/perform.py @@ -1,7 +1,7 @@ from src import EventManager, ModuleManager, utils class Module(ModuleManager.BaseModule): - @utils.hook("received.numeric.001", priority=EventManager.PRIORITY_URGENT) + @utils.hook("received.001", priority=EventManager.PRIORITY_URGENT) def on_connect(self, event): commands = event["server"].get_setting("perform", []) for i, command in enumerate(commands): diff --git a/modules/print_activity.py b/modules/print_activity.py index 43a69533..295ffeb2 100644 --- a/modules/print_activity.py +++ b/modules/print_activity.py @@ -118,7 +118,7 @@ class Module(ModuleManager.BaseModule): def on_topic(self, event): self._on_topic(event, event["user"].nickname, "changed", event["topic"], event["channel"]) - @utils.hook("received.numeric.333") + @utils.hook("received.333") def on_333(self, event): self._on_topic(event, event["setter"], "set", event["channel"].topic, event["channel"]) @@ -142,7 +142,7 @@ class Module(ModuleManager.BaseModule): self.print_line(event, "%s was renamed to %s" % ( event["old_name"], event["new_name"])) - @utils.hook("received.numeric.376") + @utils.hook("received.376") def motd_end(self, event): for line in event["server"].motd_lines: self.print_line(event, "[MOTD] %s" % line) diff --git a/modules/resume.py b/modules/resume.py index de3e6951..2954cb3b 100644 --- a/modules/resume.py +++ b/modules/resume.py @@ -52,7 +52,7 @@ class Module(ModuleManager.BaseModule): event["server"].capability_done("resume") - @utils.hook("received.numeric.001") + @utils.hook("received.001") def on_connect(self, event): event["server"].del_setting("resume-channels") diff --git a/modules/sasl/__init__.py b/modules/sasl/__init__.py index 408ba319..8aaaff17 100644 --- a/modules/sasl/__init__.py +++ b/modules/sasl/__init__.py @@ -131,17 +131,17 @@ class Module(ModuleManager.BaseModule): def _end_sasl(self, server): server.capability_done("sasl") - @utils.hook("received.numeric.908") + @utils.hook("received.908") def sasl_mechanisms(self, event): server_mechanisms = event["args"][1].split(",") mechanism = self._best_userpass_mechanism(server_mechanimsms) event["server"].sasl_mechanism = mechanism event["server"].send_authenticate(mechanism) - @utils.hook("received.numeric.903") + @utils.hook("received.903") def sasl_success(self, event): self._end_sasl(event["server"]) - @utils.hook("received.numeric.904") + @utils.hook("received.904") def sasl_failure(self, event): self.log.warn("SASL failure for %s: %s", [str(event["server"]), event["args"][1]])