Minor refactors across line_handler

This commit is contained in:
jesopo 2019-03-03 22:46:24 +00:00
parent 4aa9a06635
commit 2affba99ca
3 changed files with 6 additions and 9 deletions

View file

@ -97,11 +97,12 @@ class Module(ModuleManager.BaseModule):
def handle_366(self, event): def handle_366(self, event):
channel.handle_366(event) channel.handle_366(event)
@utils.hook("raw.received.375") @utils.hook("raw.received.375", priority=EventManager.PRIORITY_HIGH)
def motd_start(self, event): def motd_start(self, event):
core.motd_start(event) core.motd_start(event)
@utils.hook("raw.received.372") @utils.hook("raw.received.372")
@utils.hook("raw.received.375")
def motd_line(self, event): def motd_line(self, event):
core.motd_line(event) core.motd_line(event)

View file

@ -18,8 +18,7 @@ def topic(events, event):
def handle_333(events, event): def handle_333(events, event):
channel = event["server"].channels.get(event["args"][1]) channel = event["server"].channels.get(event["args"][1])
topic_setter_hostmask = event["args"][2] topic_setter = utils.irc.seperate_hostmask(event["args"][2])
topic_setter = utils.irc.seperate_hostmask(topic_setter_hostmask)
topic_time = int(event["args"][3]) if event["args"][3].isdigit() else None topic_time = int(event["args"][3]) if event["args"][3].isdigit() else None
channel.set_topic_setter(topic_setter.nickname, topic_setter.username, channel.set_topic_setter(topic_setter.nickname, topic_setter.username,
@ -113,7 +112,6 @@ def part(events, event):
def handle_324(event): def handle_324(event):
channel = event["server"].channels.get(event["args"][1]) channel = event["server"].channels.get(event["args"][1])
modes = event["args"][2] modes = event["args"][2]
if modes[0] == "+" and modes[1:]:
for mode in modes[1:]: for mode in modes[1:]:
if mode in event["server"].channel_modes: if mode in event["server"].channel_modes:
channel.add_mode(mode) channel.add_mode(mode)

View file

@ -57,7 +57,6 @@ def handle_005(events, event):
def motd_start(event): def motd_start(event):
event["server"].motd_lines.clear() event["server"].motd_lines.clear()
event["server"].motd_lines.append(event["args"][1])
def motd_line(event): def motd_line(event):
event["server"].motd_lines.append(event["args"][1]) event["server"].motd_lines.append(event["args"][1])
@ -67,7 +66,6 @@ def mode(events, event):
is_channel = target[0] in event["server"].channel_types is_channel = target[0] in event["server"].channel_types
if is_channel: if is_channel:
channel = event["server"].channels.get(target) channel = event["server"].channels.get(target)
remove = False
args = event["args"][2:] args = event["args"][2:]
_args = args[:] _args = args[:]
modes = RE_MODES.findall(event["args"][1]) modes = RE_MODES.findall(event["args"][1])