def _on_channel_mode(self, connection, source, target, args): (name, modes), mode_args = args[:2], args[2:] channel = self.find_channel(connection.server, name) if channel is not None: channel_modes = Mode.parse_modes(modes, mode_args) for mode in channel_modes: if mode.on: channel.add_mode(mode) else: channel.remove_mode(mode)
def _on_mode(self, connection, source, target, args): channel = self.find_channel(connection.server, target) if channel is not None: modes, mode_args = args[0], args[1:] channel_modes = Mode.parse_modes(modes, mode_args) for mode in channel_modes: user = channel.find_user(mode.param) if user is not None: if mode.on: user.add_mode(mode) else: user.remove_mode(mode) else: if mode.on: channel.add_mode(mode) else: channel.remove_mode(mode)