Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #1802 #1810

Merged
merged 1 commit into from
Nov 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
1 change: 1 addition & 0 deletions irc/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 8 additions & 2 deletions irc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions traditional.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down