From 809efc6793cfae22dc9302e3e3e3e2b5b7897642 Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 6 Dec 2018 08:26:07 +0000 Subject: [PATCH] Only pop MODE args when we're certain we should (pays more attention to CHANMODES ISUPPORT) --- modules/line_handler.py | 11 ++++++++--- src/IRCServer.py | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/line_handler.py b/modules/line_handler.py index b5e58f91..fee71be1 100644 --- a/modules/line_handler.py +++ b/modules/line_handler.py @@ -104,8 +104,10 @@ class Module(ModuleManager.BaseModule): event["server"].prefix_modes[mode] = symbol if "CHANMODES" in isupport: - chanmodes = list(isupport["CHANMODES"].split(",", 3)[3]) - event["server"].channel_modes = chanmodes + modes = isupport["CHANMODES"].split(",", 3) + event["server"].channel_list_modes = list(modes[0]) + event["server"].channel_paramatered_modes = list(modes[1]) + event["server"].channel_modes = list(modes[3]) if "CHANTYPES" in isupport: event["server"].channel_types = list(isupport["CHANTYPES"]) if "CASEMAPPING" in isupport: @@ -368,7 +370,10 @@ class Module(ModuleManager.BaseModule): channel.change_mode(remove, mode) elif mode in event["server"].prefix_modes and len(args): channel.change_mode(remove, mode, args.pop(0)) - else: + elif (mode in event["server"].channel_list_modes or + mode in event["server"].channel_paramatered_modes): + args.pop(0) + elif not remove: args.pop(0) self._event(event, "mode.channel", modes=modes, mode_args=_args, channel=channel, server=event["server"], user=user) diff --git a/src/IRCServer.py b/src/IRCServer.py index 61f99ef9..7a3aa150 100644 --- a/src/IRCServer.py +++ b/src/IRCServer.py @@ -54,6 +54,8 @@ class Server(IRCObject.Object): self.prefix_modes = collections.OrderedDict( (("o", "@"), ("v", "+"))) self.channel_modes = [] # type: typing.List[str] + self.channel_list_modes = [] # type: typing.List[str] + self.channel_paramatered_modes = [] # type: typing.List[str] self.channel_types = ["#"] self.case_mapping = "rfc1459"