def authorize(self, cli, ev_msg):
        if 'key' in self.props and (len(ev_msg['params']) < 2 or self.props['key'] != ev_msg['params'][1]):
            cli.dump_numeric('475', [self.name, 'Cannot join channel (+k) - bad key'])
            return False
        if 'exempt' in self.props:
            for e in self.props['exempt']:
                if match(0, e, cli.hostmask):
                    return True
        if 'ban' in self.props:
            for b in self.props['ban']:
                if match(0, b, cli.hostmask):
                    cli.dump_numeric('474', [self.name, 'You are banned.'])
                    return False
        if 'invite' in self.props and 'invite-exemption' in self.props:
            for i in self.props['invite-exemption']:
                if match(0, i, cli.hostmask):
                    return True
                # XXX - /invite command
            return False
        return True
dataset/ETHPy150Open mammon-ircd/mammon/mammon/channel.py/Channel.authorize/original