Only pop MODE args when we're certain we should (pays more attention to

CHANMODES ISUPPORT)
This commit is contained in:
jesopo 2018-12-06 08:26:07 +00:00
parent 0ecdf4d69b
commit 809efc6793
2 changed files with 10 additions and 3 deletions

View file

@ -104,8 +104,10 @@ class Module(ModuleManager.BaseModule):
event["server"].prefix_modes[mode] = symbol event["server"].prefix_modes[mode] = symbol
if "CHANMODES" in isupport: if "CHANMODES" in isupport:
chanmodes = list(isupport["CHANMODES"].split(",", 3)[3]) modes = isupport["CHANMODES"].split(",", 3)
event["server"].channel_modes = chanmodes 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: if "CHANTYPES" in isupport:
event["server"].channel_types = list(isupport["CHANTYPES"]) event["server"].channel_types = list(isupport["CHANTYPES"])
if "CASEMAPPING" in isupport: if "CASEMAPPING" in isupport:
@ -368,7 +370,10 @@ class Module(ModuleManager.BaseModule):
channel.change_mode(remove, mode) channel.change_mode(remove, mode)
elif mode in event["server"].prefix_modes and len(args): elif mode in event["server"].prefix_modes and len(args):
channel.change_mode(remove, mode, args.pop(0)) 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) args.pop(0)
self._event(event, "mode.channel", modes=modes, mode_args=_args, self._event(event, "mode.channel", modes=modes, mode_args=_args,
channel=channel, server=event["server"], user=user) channel=channel, server=event["server"], user=user)

View file

@ -54,6 +54,8 @@ class Server(IRCObject.Object):
self.prefix_modes = collections.OrderedDict( self.prefix_modes = collections.OrderedDict(
(("o", "@"), ("v", "+"))) (("o", "@"), ("v", "+")))
self.channel_modes = [] # type: typing.List[str] 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.channel_types = ["#"]
self.case_mapping = "rfc1459" self.case_mapping = "rfc1459"