3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-22 10:42:52 +01:00
This commit is contained in:
Shivaram Lingamneni 2020-04-26 02:19:10 -04:00
parent 1c946e1904
commit 57e2187742
4 changed files with 17 additions and 0 deletions

View File

@ -491,6 +491,10 @@ channels:
# how many channels can each account register?
max-channels-per-account: 15
# as a crude countermeasure against spambots, connections younger than this value
# will get an empty response to /LIST (a time period of 0 disables)
list-delay: 0s
# operator classes
oper-classes:
# local operator

View File

@ -550,6 +550,7 @@ type Config struct {
OperatorOnly bool `yaml:"operator-only"`
MaxChannelsPerAccount int `yaml:"max-channels-per-account"`
}
ListDelay time.Duration `yaml:"list-delay"`
}
OperClasses map[string]*OperClassConfig `yaml:"oper-classes"`

View File

@ -1408,6 +1408,14 @@ func languageHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *
// LIST [<channel>{,<channel>}] [<elistcond>{,<elistcond>}]
func listHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
config := server.Config()
if time.Since(client.ctime) < config.Channels.ListDelay && client.Account() == "" {
remaining := time.Until(client.ctime.Add(config.Channels.ListDelay))
csNotice(rb, fmt.Sprintf(client.t("This server requires that you wait %v after connecting before you can use /LIST. You have %v left."), config.Channels.ListDelay, remaining))
rb.Add(nil, server.name, RPL_LISTEND, client.nick, client.t("End of LIST"))
return false
}
// get channels
var channels []string
for _, param := range msg.Params {

View File

@ -512,6 +512,10 @@ channels:
# how many channels can each account register?
max-channels-per-account: 15
# as a crude countermeasure against spambots, connections younger than this value
# will get an empty response to /LIST (a time period of 0 disables)
list-delay: 0s
# operator classes
oper-classes:
# local operator