3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-25 05:19:25 +01:00
Add a config option to suppress LUSERS
This commit is contained in:
Shivaram Lingamneni 2021-11-01 04:48:31 -04:00
parent 84a5b83eb1
commit 51d573d3c9
4 changed files with 17 additions and 2 deletions

View File

@ -360,6 +360,10 @@ server:
# the default value of 512. DO NOT change this on a public server: # the default value of 512. DO NOT change this on a public server:
# max-line-len: 512 # 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 # account options
accounts: accounts:
# is account authentication enabled, i.e., can users log into existing accounts? # is account authentication enabled, i.e., can users log into existing accounts?

View File

@ -592,6 +592,7 @@ type Config struct {
IPCheckScript ScriptConfig `yaml:"ip-check-script"` IPCheckScript ScriptConfig `yaml:"ip-check-script"`
OverrideServicesHostname string `yaml:"override-services-hostname"` OverrideServicesHostname string `yaml:"override-services-hostname"`
MaxLineLen int `yaml:"max-line-len"` MaxLineLen int `yaml:"max-line-len"`
SuppressLusers bool `yaml:"suppress-lusers"`
} }
Roleplay struct { Roleplay struct {

View File

@ -419,12 +419,18 @@ func (server *Server) RplISupport(client *Client, rb *ResponseBuffer) {
func (server *Server) Lusers(client *Client, rb *ResponseBuffer) { func (server *Server) Lusers(client *Client, rb *ResponseBuffer) {
nick := client.Nick() 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_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_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_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)) 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) total := strconv.Itoa(stats.Total)
max := strconv.Itoa(stats.Max) max := strconv.Itoa(stats.Max)

View File

@ -333,6 +333,10 @@ server:
# the default value of 512. DO NOT change this on a public server: # the default value of 512. DO NOT change this on a public server:
# max-line-len: 512 # 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 # account options
accounts: accounts:
# is account authentication enabled, i.e., can users log into existing accounts? # is account authentication enabled, i.e., can users log into existing accounts?