Procházet zdrojové kódy

fix #1802

Add a config option to suppress LUSERS
tags/v2.8.0-rc1
Shivaram Lingamneni před 2 roky
rodič
revize
51d573d3c9
4 změnil soubory, kde provedl 17 přidání a 2 odebrání
  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 Zobrazit soubor

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

+ 1
- 0
irc/config.go Zobrazit soubor

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

+ 8
- 2
irc/server.go Zobrazit soubor

419
 
419
 
420
 func (server *Server) Lusers(client *Client, rb *ResponseBuffer) {
420
 func (server *Server) Lusers(client *Client, rb *ResponseBuffer) {
421
 	nick := client.Nick()
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
 	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))
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
 	rb.Add(nil, server.name, RPL_LUSEROP, nick, strconv.Itoa(stats.Operators), client.t("IRC Operators online"))
431
 	rb.Add(nil, server.name, RPL_LUSEROP, nick, strconv.Itoa(stats.Operators), client.t("IRC Operators online"))
426
 	rb.Add(nil, server.name, RPL_LUSERUNKNOWN, nick, strconv.Itoa(stats.Unknown), client.t("unregistered connections"))
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
 	rb.Add(nil, server.name, RPL_LUSERME, nick, fmt.Sprintf(client.t("I have %[1]d clients and %[2]d servers"), stats.Total, 0))
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
 	total := strconv.Itoa(stats.Total)
435
 	total := strconv.Itoa(stats.Total)
430
 	max := strconv.Itoa(stats.Max)
436
 	max := strconv.Itoa(stats.Max)

+ 4
- 0
traditional.yaml Zobrazit soubor

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

Načítá se…
Zrušit
Uložit