

def set_legacy_modes(self, client, in_str, args):
    before = copy.deepcopy(self.props)
    before_users = copy.deepcopy({member.client.nickname: member.props for member in self.members})
    mod = False
    for i in in_str:
        if (i == '+'):
            mod = True
        elif (i == '-'):
            mod = False
        else:
            if (i not in channel_flag_items):
                client.dump_numeric('472', [i, 'is an unknown mode char to me'])
                continue
            prop = channel_flag_items[i]
            if ((prop == 'ban') or (prop == 'invite-exemption') or (prop == 'exemption') or (prop == 'quiet')):
                if (prop not in self.props):
                    self.props[prop] = CaseInsensitiveDict()
                if (len(args) == 0):
                    for (user, info) in self.props[prop].items():
                        client.dump_numeric('367', [self.name, user, info[0], info[1]])
                    client.dump_numeric('368', [self.name, (('End of Channel ' + prop.title()) + ' List')])
                    continue
                if (not self.get_member(client).props.get('set-modes', False)):
                    client.dump_numeric('482', [self.name, "You're not a channel operator"])
                    continue
                arg = args.pop(0)
                if ((mod == False) and (arg in self.props[prop])):
                    del self.props[prop][arg]
                if (mod == True):
                    self.props[prop][arg] = (client.hostmask, client.ctx.current_ts)
                continue
            if (not self.get_member(client).props.get('set-modes', False)):
                client.dump_numeric('482', [self.name, "You're not a channel operator"])
                continue
            if ((prop == 'key') or (prop == 'limit') or (prop == 'join-throttle') or (prop == 'forward')):
                if (len(args) > 0):
                    self.props[prop] = args.pop(0)
                continue
    self.flush_legacy_mode_change(client, before, self.props, before_users, {member.client.nickname: member.props for member in self.members})

dataset/ETHPy150Open mammon-ircd/mammon/mammon/channel.py Channel.set_legacy_modes/original