diff options
| author | 2019-09-12 22:40:23 +0100 | |
|---|---|---|
| committer | 2019-09-12 22:40:23 +0100 | |
| commit | 7094d94cd7ceeaa13626eb337858a5ef7013a142 (patch) | |
| tree | b115e1fe1c3cda404b966090a2271dd31c6e4a78 /modules/channel_op.py | |
| parent | _check_flags() when flags are changed (diff) | |
| signature | ||
only apply modes for !flags when the user doesn't have them already
Diffstat (limited to 'modules/channel_op.py')
| -rw-r--r-- | modules/channel_op.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/modules/channel_op.py b/modules/channel_op.py index 0861fbf4..04fc67e7 100644 --- a/modules/channel_op.py +++ b/modules/channel_op.py @@ -299,23 +299,30 @@ class Module(ModuleManager.BaseModule): def _check_flags(self, channel, user): flags = channel.get_user_setting(user.get_id(), "flags", "") + if flags: - modes = [] - kick_reason = None identified = not user.get_identified_account() == None + current_modes = channel.get_user_modes(user) + modes = [] + kick_reason = None for flag in list(flags): - if flag == "O": + if flag == "O" and identified: modes.append(("o", user.nickname)) - elif flag == "V": + elif flag == "V" and identified: modes.append(("v", user.nickname)) elif flag == "b": modes.append(("b", self._get_hostmask(channel, user))) kick_reason = "User is banned from this channel" + new_modes = [] + for mode, arg in modes: + if not mode in current_modes: + new_modes.append((mode, arg)) + # break up in to chunks of (maximum) 3 # https://tools.ietf.org/html/rfc2812.html#section-3.2.3 - for chunk in self._chunk(modes, 3): + for chunk in self._chunk(new_modes, 3): chars, args = list(zip(*chunk)) channel.send_mode("+%s" % "".join(chars), list(args)) if not kick_reason == None: |
