diff --git a/modules/line_handler.py b/modules/line_handler.py index 3aec3f13..ddba32ea 100644 --- a/modules/line_handler.py +++ b/modules/line_handler.py @@ -178,6 +178,14 @@ class Module(ModuleManager.BaseModule): def handle_366(self, event): event["server"].send_whox(event["args"][1], "n", "ahnrtu", "111") + @utils.hook("raw.375") + def motd_start(self, event): + event["server"].motd_lines.clear() + + @utils.hook("raw.372") + def motd_line(self, event): + event["server"].motd_lines.append(event["args"][1]) + # on user joining channel @utils.hook("raw.join") def join(self, event): diff --git a/modules/print_activity.py b/modules/print_activity.py index bfeeef01..57eff958 100644 --- a/modules/print_activity.py +++ b/modules/print_activity.py @@ -119,3 +119,8 @@ class Module(ModuleManager.BaseModule): def rename(self, event): self.print_line(event, "%s was renamed to %s" % ( event["old_name"], event["new_name"])) + + @utils.hook("received.numeric.376") + def motd_end(self, event): + for line in event["server"].motd_lines: + self.print_line(event, "[MOTD] %s" % line) diff --git a/src/IRCServer.py b/src/IRCServer.py index b6254fa0..e135bee8 100644 --- a/src/IRCServer.py +++ b/src/IRCServer.py @@ -50,6 +50,9 @@ class Server(IRCObject.Object): self.channel_types = ["#"] self.case_mapping = "rfc1459" + self.motd_lines = [] # type: typing.List[str] + self.motd_done = False + self.last_read = time.monotonic() self.last_send = None # type: typing.Optional[float]