Print MOTD in modules/print_activity.py (after caching it in

modules/line_handler.py)
This commit is contained in:
jesopo 2018-11-13 14:59:47 +00:00
parent e9c9ec778c
commit 555e8faa03
3 changed files with 16 additions and 0 deletions

View file

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

View file

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

View file

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