fix atheme2json to handle mlock mode removal

For example, if the mlock is set to `-i`, `i` is not present in the
`modes` and thus it would error.

I'm inclined to think that the negative mlock feature doesn't behave
correctly, because the mlock of `-i` (or `-n`) would prevent anyone from
ever setting those modes on the channel. Which this does not appear to
be the case.

Fixes #1401
This commit is contained in:
Kyle Fuller 2020-11-27 16:25:22 +00:00
parent f04648e081
commit 97bb044640
1 changed files with 1 additions and 2 deletions

View File

@ -65,8 +65,7 @@ def convert(infile):
for flag, mode in CMODE_FLAG_TO_MODE.items(): for flag, mode in CMODE_FLAG_TO_MODE.items():
if flag & mlock_on != 0: if flag & mlock_on != 0:
modes.add(mode) modes.add(mode)
for flag, mode in CMODE_FLAG_TO_MODE.items(): elif flag & mlock_off != 0 and mode in modes:
if flag & mlock_off != 0:
modes.remove(mode) modes.remove(mode)
chdata['modes'] = ''.join(modes) chdata['modes'] = ''.join(modes)
chdata['limit'] = int(parts[7]) chdata['limit'] = int(parts[7])