3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

_parse_modes: apply modes to a temporary mode list as we parse them

Fixes #573.

Old, broken behaviour:
irc.parse_modes('#test', '+b-bb *!*@new.ban *!*@nonexistent.ban *!*@new.ban')
=> [('+b', '*!*@new.ban')]

Fixed:
irc.parse_modes('#test', '+b-bb *!*@new.ban *!*@nonexistent.ban *!*@new.ban')
=> [('+b', '*!*@new.ban'), ('-b', '*!*@new.ban')]
This commit is contained in:
James Lu 2018-03-02 20:57:16 -08:00
parent f12318b5dc
commit 5a00454a8d

View File

@ -633,7 +633,12 @@ class PyLinkNetworkCoreWithUtils(PyLinkNetworkCore):
'argument but none was found. (modestring: %r)', 'argument but none was found. (modestring: %r)',
self.name, mode, modestring) self.name, mode, modestring)
continue # Skip this mode; don't error out completely. continue # Skip this mode; don't error out completely.
res.append((prefix + mode, arg)) newmode = (prefix + mode, arg)
res.append(newmode)
# Tentatively apply the new mode to the "existing" mode list.
existing = self._apply_modes(existing, [newmode], is_channel=is_channel)
return res return res
def parse_modes(self, target, args): def parse_modes(self, target, args):