diff --git a/default.yaml b/default.yaml index 14256cd4..f450c47c 100644 --- a/default.yaml +++ b/default.yaml @@ -360,6 +360,10 @@ server: # the default value of 512. DO NOT change this on a public server: # max-line-len: 512 + # send all 0's as the LUSERS (user counts) output to non-operators; potentially useful + # if you don't want to publicize how popular the server is + suppress-lusers: false + # account options accounts: # is account authentication enabled, i.e., can users log into existing accounts? diff --git a/irc/config.go b/irc/config.go index a0971de7..3d753b43 100644 --- a/irc/config.go +++ b/irc/config.go @@ -592,6 +592,7 @@ type Config struct { IPCheckScript ScriptConfig `yaml:"ip-check-script"` OverrideServicesHostname string `yaml:"override-services-hostname"` MaxLineLen int `yaml:"max-line-len"` + SuppressLusers bool `yaml:"suppress-lusers"` } Roleplay struct { diff --git a/irc/server.go b/irc/server.go index 7a43f0f4..0992dc0a 100644 --- a/irc/server.go +++ b/irc/server.go @@ -419,12 +419,18 @@ func (server *Server) RplISupport(client *Client, rb *ResponseBuffer) { func (server *Server) Lusers(client *Client, rb *ResponseBuffer) { nick := client.Nick() - stats := server.stats.GetValues() + config := server.Config() + var stats StatsValues + var numChannels int + if !config.Server.SuppressLusers || client.HasRoleCapabs("ban") { + stats = server.stats.GetValues() + numChannels = server.channels.Len() + } rb.Add(nil, server.name, RPL_LUSERCLIENT, nick, fmt.Sprintf(client.t("There are %[1]d users and %[2]d invisible on %[3]d server(s)"), stats.Total-stats.Invisible, stats.Invisible, 1)) rb.Add(nil, server.name, RPL_LUSEROP, nick, strconv.Itoa(stats.Operators), client.t("IRC Operators online")) rb.Add(nil, server.name, RPL_LUSERUNKNOWN, nick, strconv.Itoa(stats.Unknown), client.t("unregistered connections")) - rb.Add(nil, server.name, RPL_LUSERCHANNELS, nick, strconv.Itoa(server.channels.Len()), client.t("channels formed")) + rb.Add(nil, server.name, RPL_LUSERCHANNELS, nick, strconv.Itoa(numChannels), client.t("channels formed")) rb.Add(nil, server.name, RPL_LUSERME, nick, fmt.Sprintf(client.t("I have %[1]d clients and %[2]d servers"), stats.Total, 0)) total := strconv.Itoa(stats.Total) max := strconv.Itoa(stats.Max) diff --git a/traditional.yaml b/traditional.yaml index 948bd182..1c784dbd 100644 --- a/traditional.yaml +++ b/traditional.yaml @@ -333,6 +333,10 @@ server: # the default value of 512. DO NOT change this on a public server: # max-line-len: 512 + # send all 0's as the LUSERS (user counts) output to non-operators; potentially useful + # if you don't want to publicize how popular the server is + suppress-lusers: false + # account options accounts: # is account authentication enabled, i.e., can users log into existing accounts?