trans :: TransformHSpec
trans env = env {Env.actions=map f (Env.actions env)}
  where
    maxChans = getConfigInt (Env.config env) "client" "max_channels"
    channels = Client.channels (Env.client env)
    f a@(ChanAction "Join" chan _) = if length channels < maxChans
        then a
        else GenericAction $ \e -> sendNumeric e numERR_TOOMANYCHANNELS [chan, "You have joined too many channels"]
            >> return e
    f a = a
trans :: TransformHSpec
trans env = env {Env.actions=map f (Env.actions env)}
  where
    maxChans = getConfigInt (Env.config env) "client" "max_channels"
    channels = Client.channels (Env.client env)
    f a@(ChanAction "Join" chan _) = if length channels < maxChans
        then a
        else GenericAction $ \e -> sendNumeric e numERR_TOOMANYCHANNELS [chan, "You have joined too many channels"]
            >> return e
    f a = a
trans env = env {Env.actions=map f (Env.actions env)}
  where
    maxChans = getConfigInt (Env.config env) "client" "max_channels"
    channels = Client.channels (Env.client env)
    f a@(ChanAction "Join" chan _) = if length channels < maxChans
        then a
        else GenericAction $ \e -> sendNumeric e numERR_TOOMANYCHANNELS [chan, "You have joined too many channels"]
            >> return e
    f a = a