Bläddra i källkod

fix #1802

Add a config option to suppress LUSERS
tags/v2.8.0-rc1
Shivaram Lingamneni 2 år sedan
förälder
incheckning
51d573d3c9
4 ändrade filer med 17 tillägg och 2 borttagningar
  1. 4
    0
      default.yaml
  2. 1
    0
      irc/config.go
  3. 8
    2
      irc/server.go
  4. 4
    0
      traditional.yaml

+ 4
- 0
default.yaml Visa fil

@@ -360,6 +360,10 @@ server:
360 360
     # the default value of 512. DO NOT change this on a public server:
361 361
     # max-line-len: 512
362 362
 
363
+    # send all 0's as the LUSERS (user counts) output to non-operators; potentially useful
364
+    # if you don't want to publicize how popular the server is
365
+    suppress-lusers: false
366
+
363 367
 # account options
364 368
 accounts:
365 369
     # is account authentication enabled, i.e., can users log into existing accounts?

+ 1
- 0
irc/config.go Visa fil

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

+ 8
- 2
irc/server.go Visa fil

@@ -419,12 +419,18 @@ func (server *Server) RplISupport(client *Client, rb *ResponseBuffer) {
419 419
 
420 420
 func (server *Server) Lusers(client *Client, rb *ResponseBuffer) {
421 421
 	nick := client.Nick()
422
-	stats := server.stats.GetValues()
422
+	config := server.Config()
423
+	var stats StatsValues
424
+	var numChannels int
425
+	if !config.Server.SuppressLusers || client.HasRoleCapabs("ban") {
426
+		stats = server.stats.GetValues()
427
+		numChannels = server.channels.Len()
428
+	}
423 429
 
424 430
 	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))
425 431
 	rb.Add(nil, server.name, RPL_LUSEROP, nick, strconv.Itoa(stats.Operators), client.t("IRC Operators online"))
426 432
 	rb.Add(nil, server.name, RPL_LUSERUNKNOWN, nick, strconv.Itoa(stats.Unknown), client.t("unregistered connections"))
427
-	rb.Add(nil, server.name, RPL_LUSERCHANNELS, nick, strconv.Itoa(server.channels.Len()), client.t("channels formed"))
433
+	rb.Add(nil, server.name, RPL_LUSERCHANNELS, nick, strconv.Itoa(numChannels), client.t("channels formed"))
428 434
 	rb.Add(nil, server.name, RPL_LUSERME, nick, fmt.Sprintf(client.t("I have %[1]d clients and %[2]d servers"), stats.Total, 0))
429 435
 	total := strconv.Itoa(stats.Total)
430 436
 	max := strconv.Itoa(stats.Max)

+ 4
- 0
traditional.yaml Visa fil

@@ -333,6 +333,10 @@ server:
333 333
     # the default value of 512. DO NOT change this on a public server:
334 334
     # max-line-len: 512
335 335
 
336
+    # send all 0's as the LUSERS (user counts) output to non-operators; potentially useful
337
+    # if you don't want to publicize how popular the server is
338
+    suppress-lusers: false
339
+
336 340
 # account options
337 341
 accounts:
338 342
     # is account authentication enabled, i.e., can users log into existing accounts?

Laddar…
Avbryt
Spara