1
0
Fork 0
forked from External/ergo

Merge pull request #352 from slingamn/chanreglimit.1

track channel registrations per account
This commit is contained in:
Daniel Oaks 2019-02-18 07:08:57 +10:00 committed by GitHub
commit 7cf8aaccf6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 154 additions and 14 deletions

View file

@ -1159,7 +1159,13 @@ func joinHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp
keys = strings.Split(msg.Params[1], ",")
}
config := server.Config()
oper := client.Oper()
for i, name := range channels {
if config.Channels.MaxChannelsPerClient <= client.NumChannels() && oper == nil {
rb.Add(nil, server.name, ERR_TOOMANYCHANNELS, client.Nick(), name, client.t("You have joined too many channels"))
return false
}
var key string
if len(keys) > i {
key = keys[i]