@eventmgr_rfc1459.message('PART', min_params=1, update_idle=True)
def m_PART(cli, ev_msg):
    chanlist = ev_msg['params'][0].split(',')

    for chan in chanlist:
        if not validate_chan(chan):
            cli.dump_numeric('479', [ev_msg['params'][0], 'Illegal channel name'])
            return

        ch = cli.ctx.chmgr.get(chan, create=False)
        if not ch:
            cli.dump_numeric('403', [chan, 'No such channel'])
            return

        if not ch.has_member(cli):
            cli.dump_numeric('442', [ch.name, "You're not on that channel"])
            return

        if len(ev_msg['params']) > 1:
            message = ev_msg['params'][1]
        else:
            message = ''

        # part channel
        info = {
            'channel': ch,
            'client': cli,
            'message': message,
        }
        eventmgr_core.dispatch('channel part', info)
dataset/ETHPy150Open mammon-ircd/mammon/mammon/channel.py/m_PART/original