From deedab7248ca6ef9449d0fdd9636c8ad650d5441 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 20 Feb 2019 17:08:30 +0000 Subject: [PATCH] Add IRCServer.send_joins, a nicer interface than manually `",".join`ing --- modules/channel_save.py | 3 +-- src/IRCServer.py | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/channel_save.py b/modules/channel_save.py index e434c878..d32fb26c 100644 --- a/modules/channel_save.py +++ b/modules/channel_save.py @@ -20,8 +20,7 @@ class Module(ModuleManager.BaseModule): key = None if len(keys_sorted) <= i else keys_sorted[i] event["server"].attempted_join[channel] = key - event["server"].send_join( - ",".join(channels_sorted), keys_sorted) + event["server"].send_joins(channels_sorted, keys_sorted) @utils.hook("self.join") def on_join(self, event): diff --git a/src/IRCServer.py b/src/IRCServer.py index 3f545c58..484a2892 100644 --- a/src/IRCServer.py +++ b/src/IRCServer.py @@ -309,6 +309,10 @@ class Server(IRCObject.Object): def send_join(self, channel_name: str, keys: typing.List[str]=None ) -> IRCLine.Line: return self.send(utils.irc.protocol.join(channel_name, keys)) + def send_joins(self, channel_names: typing.List[str], + keys: typing.List[str]=None): + return self.send(utils.irc.protocol.join(",".join(channel_names), + keys)) def send_part(self, channel_name: str, reason: str=None) -> IRCLine.Line: return self.send(utils.irc.protocol.part(channel_name, reason)) def send_quit(self, reason: str="Leaving") -> IRCLine.Line: